大佬教程收集整理的这篇文章主要介绍了ios – UIAlertController无法满足约束,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我的问题是当我尝试呈现样式ActionSheet的UIAlertController时.
这是我的代码:
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];
这是错误:
Unable to simultaneously satisfy consTraints. Probably at least one of the consTraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted consTraint or consTraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConsTraints that you don't understand,refer to the documentation for the UIView property translatesAutoresizingMaskIntoConsTraints) ( "<NSLayoutConsTraint:0x7c00ab40 H:[UIView:0x7c0764c0(304)]>","<NSLayoutConsTraint:0x7b6c7f80 _UIAlertControllerView:0x7b6c2e50'title'.width >= UIView:0x7b6c3230.width>","<NSLayoutConsTraint:0x7ccdfe40 _UIAlertControllerView:0x7b6c2e50'title'.width == UIView:0x7b6efbe0.width>","<NSAutoresizingMaskLayoutConsTraint:0x7c33b9d0 h=--& v=--& H:[UIView:0x7c1094e0(0)]>" ) Will attempt to recover by breaking consTraint <NSLayoutConsTraint:0x7c00ab40 H:[UIView:0x7c0764c0(304)]>
谢谢你们.
以上是大佬教程为你收集整理的ios – UIAlertController无法满足约束全部内容,希望文章能够帮你解决ios – UIAlertController无法满足约束所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。