ios - iOS8 的 UIAlertController 标题始终为 nil

标签 ios ios8 uialertview uialertcontroller

自 iOS8 和 Xcode 6.0.1 以来我遇到了一个问题,我的警告对话框的标题没有出现。所以我将 UIAlertView 更改为 UIAlertController 但我遇到了同样的问题......

我的警报标题总是为零,而且显示非常难看,因为我没有分隔线。

你知道我为什么会有这个吗?

    UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"title" message:@"message" preferredStyle:UIAlertControllerStyleAlert];

    [alert addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
        [self dismissViewControllerAnimated:YES completion:nil];
    }]];

    [self presentViewController:alert animated:YES completion:nil];

但这是结果

Alertview without title

(lldb) po alert.title
nil
(lldb) po alert.message
message

谢谢。

最佳答案

感谢@Myaaoonn,我解决了我的问题!

UIAlertView title does not display

I have just Remove the following method from my ViewController Category Class And its working fyn!

- (void)setTitle:(NSString *)title
{
   // My Code
}

关于ios - iOS8 的 UIAlertController 标题始终为 nil,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26253231/

相关文章:

iphone - UITableviewCell 在表中没有数据时显示消息

ios - 如何在不同的郊区覆盖带有彩色的 ta GMSMapView?

ios8 - 当屏幕处于横向模式时,UIAlertview 以纵向模式显示

ios - Xcode6中的iPhone Simulator发送Mac的OS版本

ios - 当多个警报 View 出现在同一个 View Controller 中时,有没有办法错开?

ios - iOS 7 上的 UIAlertView 不显示标题

ios - 如何为不同的 iOS 显示器计算正确的图像尺寸?

ios - 如何在观看之前准备内容?

ios - 以编程方式使用大小类

ios - 自定义 UIAlertView 没有委托(delegate)回调?