UIAlertController在iPad上运行崩溃

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上是没有这样的问题。这个需要注意一下

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。