2015-02-23 88 views
0

我的UIAlertController未显示,但代码看起来正确。UIAlertController未显示任何内容

UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Lorem" 
                      message:@"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis sed ultrices nisl." 
                     preferredStyle:UIAlertControllerStyleAlert]; 
    [alertController addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil]]; 

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

回答

0

只是回答我的问题,因为我失去了对这个一小时,并希望其他节省的人头痛。

确保你没有从viewDidLoad调用这段代码,如果你在viewController的早期需要它,然后从viewWillAppear调用它。