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