【发布时间】:2016-06-05 15:20:50
【问题描述】:
在我的 iOS 应用程序的一个 ViewController 中,有一个具有此功能的 UIButton:
@IBAction func openSettings(sender: AnyObject) {
UIApplication.sharedApplication().openURL(NSURL(string: UIApplicationOpenSettingsURLString)!)
}
这可以正常工作,但是当从纵向更改为横向时,按钮不再起作用。我正在为此按钮使用自动布局。控制台这样说:
2016-06-05 17:15:31.238 MyApp[3975:1756888] 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.
(
"<_UILayoutSupportConstraint:0x15cf4a540 V:[_UILayoutGuide:0x15cf685a0(0)]>",
"<_UILayoutSupportConstraint:0x15cd5c7d0 V:|-(0)-[_UILayoutGuide:0x15cf685a0] (Names: '|':UIView:0x15e202490 )>",
"<NSLayoutConstraint:0x15cf68f60 V:[_UILayoutGuide:0x15cf685a0]-(265)-[UIButton:0x15cf65310'Enable Push!']>",
"<NSLayoutConstraint:0x15cf68fb0 UIButton:0x15cf65310'Enable Push!'.centerY == UIView:0x15e202490.centerY>",
"<NSLayoutConstraint:0x15cf4b640 'UIView-Encapsulated-Layout-Height' V:[UIView:0x15e202490(414)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x15cf68f60 V:[_UILayoutGuide:0x15cf685a0]-(265)-[UIButton:0x15cf65310'Enable Push!']>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
有人知道或看到原因吗?
【问题讨论】:
标签: ios iphone swift uibutton autolayout