将 Storyboard 中的 AutoLayout 设置为 uiview,Uibutton 在 Uiview 中分布不均匀(约束)

set AutoLayout from Storyboard to uiview, Uibutton not spread equally in Uiview (constraints )

enter image description here我设置了Constraints Of 第一个 Uiview (0,0,320,530) 第二个 uiview(0,0,320,38) 在第二个视图中有五个相同大小的 UIbuttons (64,38)

问题是五个 Uibutton 分布不均 enter image description here

我收到了这样的消息


<p>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) 
(
    "",
    "",
    "",
    ""
)</p>

<p>Will attempt to recover by breaking constraint 
</p>

<p>Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in  may also be helpful.
2015-10-08 17:18:57.971 Profit Karma[5261:139743] 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) 
(
    "",
    "",
    "",
    "<_UILayoutSupportConstraint:0x7fc861543c20 V:[_UILayoutGuide:0x7fc8614ac0e0(0)]>",
    "<_UILayoutSupportConstraint:0x7fc86156eef0 _UILayoutGuide:0x7fc8614ac0e0.bottom == UIView:0x7fc861493c70.bottom>",
    ""
)</p>

<p>Will attempt to recover by breaking constraint 
</p>

<p>Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in  may also be helpful.
2015-10-08 17:18:57.972 Profit Karma[5261:139743] 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) 
(
    "",
    "",
    "",
    "",
    "",
    ""
)</p>

<p>Will attempt to recover by breaking constraint 
</p>

<p>Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in  may also be helpful.
2015-10-08 17:18:57.974 Profit Karma[5261:139743] 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) 
(
    "",
    "",
    "",
    "",
    "",
    ""
)</p>

<p>Will attempt to recover by breaking constraint 
</p>

<p>Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in  may also be helpful.
2015-10-08 17:18:57.975 Profit Karma[5261:139743] 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) 
(
    "",
    "",
    "",
    "",
    "",
    "",
    "<_UILayoutSupportConstraint:0x7fc861543c20 V:[_UILayoutGuide:0x7fc8614ac0e0(0)]>",
    "<_UILayoutSupportConstraint:0x7fc86156eef0 _UILayoutGuide:0x7fc8614ac0e0.bottom == UIView:0x7fc861493c70.bottom>",
    "",
    ""
)</p>

<p>Will attempt to recover by breaking constraint 
</p>

<p>Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in  may also be helpful.
2015-10-08 17:18:57.978 Profit Karma[5261:139743] navigationController : -47.000000 -64.000000 414.000000 44.000000
2015-10-08 17:18:57.982 Profit Karma[5261:139743] userDisplayTempScreen 1
2015-10-08 17:18:58.000 Profit Karma[5261:139743] 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) 
(
    "",
    "",
    "",
    ""
)</p>

<p>Will attempt to recover by breaking constraint 
</p>

<p>Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in  may also be helpful.
2015-10-08 17:18:58.002 Profit Karma[5261:139743] 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) 
(
    "",
    "",
    "",
    "<_UILayoutSupportConstraint:0x7fc8614f0120 V:[_UILayoutGuide:0x7fc8616009b0(0)]>",
    "<_UILayoutSupportConstraint:0x7fc8614d5a30 _UILayoutGuide:0x7fc8616009b0.bottom == UIView:0x7fc8614fb550.bottom>",
    ""
)</p>

<p>Will attempt to recover by breaking constraint 
</p>

<p>Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in  may also be helpful.
2015-10-08 17:18:58.004 Profit Karma[5261:139743] 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) 
(
    "",
    "",
    "",
    "",
    "",
    ""
)</p>

<p>Will attempt to recover by breaking constraint 
</p>

<p>Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in  may also be helpful.
2015-10-08 17:18:58.006 Profit Karma[5261:139743] 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) 
(
    "",
    "",
    "",
    "",
    "<_UILayoutSupportConstraint:0x7fc8614f0120 V:[_UILayoutGuide:0x7fc8616009b0(0)]>",
    "<_UILayoutSupportConstraint:0x7fc8614d5a30 _UILayoutGuide:0x7fc8616009b0.bottom == UIView:0x7fc8614fb550.bottom>",
    "",
    ""
)</p>

<p>Will attempt to recover by breaking constraint 
</p>

<p>Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in  may also be helpful.
2015-10-08 17:18:58.007 Profit Karma[5261:139743] 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) 
(
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    ""
)</p>

<p>Will attempt to recover by breaking constraint 
</p>

<p>Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in  may also be helpful.
2015-10-08 17:18:58.021 Profit Karma[5261:139743] 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) 
(
    "",
    "",
    "",
    "",
    "",
    "",
    "<_UILayoutSupportConstraint:0x7fc8614f0120 V:[_UILayoutGuide:0x7fc8616009b0(0)]>",
    "<_UILayoutSupportConstraint:0x7fc8614d5a30 _UILayoutGuide:0x7fc8616009b0.bottom == UIView:0x7fc8614fb550.bottom>",
    "",
    ""
)</p>

<p>Will attempt to recover by breaking constraint 
</p>

<p>Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in  may also be helpful.
2015-10-08 17:18:58.111 Profit Karma[5261:139743] 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) 
(
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    ""
)</p>

<p>Will attempt to recover by breaking constraint 
</p>

<p>Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in  may also be helpful.
2015-10-08 17:18:58.112 Profit Karma[5261:139743] 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) 
(
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    ""
)</p>

<p>Will attempt to recover by breaking constraint 
</p>

<p>Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in  may also be helpful.
2015-10-08 17:18:58.114 Profit Karma[5261:139743] 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) 
(
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    ""
)</p>

<p>Will attempt to recover by breaking constraint 
</p>

<p>Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in  may also be helpful.
2015-10-08 17:18:58.117 Profit Karma[5261:139743] 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) 
(
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "<_UILayoutSupportConstraint:0x7fc8614f0120 V:[_UILayoutGuide:0x7fc8616009b0(0)]>",
    "<_UILayoutSupportConstraint:0x7fc8614d5a30 _UILayoutGuide:0x7fc8616009b0.bottom == UIView:0x7fc8614fb550.bottom>",
    "",
    ""
)</p>

<p>Will attempt to recover by breaking constraint 
</p>

<p>Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in  may also be helpful.
2015-10-08 17:18:58.119 Profit Karma[5261:139743] 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) 
(
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "<_UILayoutSupportConstraint:0x7fc8614f0120 V:[_UILayoutGuide:0x7fc8616009b0(0)]>",
    "<_UILayoutSupportConstraint:0x7fc8614d5a30 _UILayoutGuide:0x7fc8616009b0.bottom == UIView:0x7fc8614fb550.bottom>",
    "",
    ""
)</p>

<p>Will attempt to recover by breaking constraint 
</p>

<p>Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in  may also be helpful.</p>

在您提供的演示项目中,我只是删除了除 bottomview 高度限制之外的所有宽度和高度限制....

删除了按钮的高度和宽度限制,并为所有按钮提供了相同的宽度限制....

就是这样...问题解决了

这是工作项目...

Working Project link

所以最后的约束条件是:---

  • 固定了两个 UIView 的所有边缘

  • 将高度设置为底视图

  • 固定所有按钮的所有边缘并赋予相等的宽度