美文网首页iOS&Android
UIAlertController在iPad上运行崩溃

UIAlertController在iPad上运行崩溃

作者: BigBossAllen | 来源:发表于2017-12-06 14:50 被阅读0次

UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"title" message:nil preferredStyle:UIAlertControllerStyleActionSheet];

UIAlertAction *action = [UIAlertAction actionWithTitle:@"Title" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {

}

[alertController addAction:action];

alertController.popoverPresentationController.sourceView = self.view;

alertController.popoverPresentationController.sourceRect = CGRectMake(100,100,100.0,100.0);

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

其中

alertController.popoverPresentationController.sourceView

alertController.popoverPresentationController.sourceRect

如果iPad上不加这两句代码的话,会导致程序崩溃的。iPhone上是没有这样的问题。这个需要注意一下

相关文章

网友评论

    本文标题:UIAlertController在iPad上运行崩溃

    本文链接:https://www.haomeiwen.com/subject/kezkixtx.html