ios - 征求用户意见,用自定义的UIAlertView,最多能通过多少?

标签 ios uialertview

我正在创建一个应用程序,有一次我想通过自定义 UIAlertView 征求用户意见。经过大量研究并阅读了有关该主题的内容后,我对某些事情感到有些困惑...

我们可以将哪些对象(UITextfields、UIImages...)添加到 UIAlertView 中?

因为我发现了这个:

The UIAlertView class is intended to be used as-is and does not support subclassing. The view hierarchy for this class is private and must not be modified.

但这本可以被接受,例如:

UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"title" message:@"msg" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil];
UITextField *txtField = [[UITextField alloc] initWithFrame:CGRectMake(12.0, 45.0, 260.0, 25.0)];
[alertView addSubview:txtField];
[alertView show];
[alertView release];

(有关更多信息,请参阅 this link)

例如,如果我不想要带有消息和标题参数的蓝框,我可以只执行以下代码吗:

UIAlertView *alert = [[UIAlertView alloc] init];
[alert addSubview:a_UIButton];
[alert addSubview:a_UIImageview]; 
[alert show];

因此,通过这种代码,我可以获得将所有应用程序置于暂停模式的优势(如果它有效!),并且所有应用程序都是自定义的。但有可能吗?会不会被拒绝?

非常感谢!

最佳答案

与其尝试自定义“UIAlertView”,不如创建自己的自定义 AlertView(来自“UIView”)并添加那个当你想显示它时作为 subview ?

我们不知道 Apple 是否(或如何)在未来的 iOS 版本(例如 iOS 7)中更改 UIAlertView 的内部架构,这会破坏所有应用程序中对其所做的各种自定义设置到目前为止。这就是 Apple 在其文档中提出该警告的原因。

关于ios - 征求用户意见,用自定义的UIAlertView,最多能通过多少?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15799211/

相关文章:

javascript - 使用 JS 或 CSS 检测 iOS 设备是否有 home bar

ios - 'mapView(_:viewFor:)' 的重新声明无效

iphone - NSDate 和不同的时区?

ios - 如何在 sendAsynchronousRequest 的 completionHandler 中显示 UIAlertView?

ios - 键盘未显示

ios - Flutter IOS 产品口味未运行

iphone - 重叠的 CAShapeLayer 轮廓

ios - 以编程方式关注创建为 AccessoryView 的 UITextView

ios - iOS 6 Beta 3 (ipad 3) 中的 UIAlertView 似乎没有触发委托(delegate)中的代码

iphone - 如何在 Swift 中使用警报 View 解除 segue?