iOS&Android

UIAlertController在iPad上运行崩溃

2017-12-06  本文已影响0人  BigBossAllen

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

上一篇下一篇

猜你喜欢

热点阅读