简体   繁体   English

UIAlertController标题在iOS8中始终为零

[英]UIAlertController title is always nil with iOS8

I have a problem since iOS8 and Xcode 6.0.1, the title of my alert dialogs doesn't appear. 自iOS8和Xcode 6.0.1起出现问题,我的警报对话框的标题没有出现。 So I changed my UIAlertView to UIAlertController but I have the same issue... 所以我将UIAlertView更改为UIAlertController,但是我遇到了同样的问题...

The title of my alert is always to nil and the displaying is very ugly because I don't have the serparator lines. 我的警报标题始终为nil,并且显示非常难看,因为我没有分隔线。

Do you know why i have this ? 你知道我为什么有这个吗?

    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];

But this is the result 但这是结果

没有标题的Alertview

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

Thank you. 谢谢。

I resolved my problem thanks to @Myaaoonn ! 我通过@Myaaoonn解决了我的问题!

UIAlertView title does not display UIAlertView标题不显示

I have just Remove the following method from my ViewController Category Class And its working fyn! 我刚刚从我的ViewController类别类中删除了以下方法,并且该方法可以正常工作!

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

Try calling the UIAlertView like this: 尝试像这样调用UIAlertView:

[[[UIAlertView alloc] initWithTitle:<#title#>
                            message:<#msg#>
                           delegate:nil
                  cancelButtonTitle:<#cancel button#>
                  otherButtonTitles:<#buttons#>,nil] show];

Does the title still not show? 标题仍然不显示吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM