小编bri*_*rin的帖子

UIAlertController无法满足约束

我将我所有的UIActionSheetUIAlertViewUIAlertController

我的问题是当我尝试呈现UIAlertControllerActionSheet样式时。这是我的代码:

UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Title"
                                                               message:@"My message"
                                                        preferredStyle:UIAlertControllerStyleActionSheet];

UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil];
[alert addAction:cancelAction];

UIAlertAction *OKAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil];
[alert addAction:OKAction];

UIAlertAction *destroyAction = [UIAlertAction actionWithTitle:@"Destroy" style:UIAlertActionStyleDestructive handler:nil];
[alert addAction:destroyAction];

UIPopoverPresentationController *popPresenter = [alert popoverPresentationController];
popPresenter.sourceView = self.view;
popPresenter.sourceRect = self.view.bounds;

[self presentViewController:alert animated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud)

这是错误:

Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c uiactionsheet ios uialertcontroller

10
推荐指数
1
解决办法
3826
查看次数