0

我有一个故事板文件,其中添加了一个 UITableView 和一个 UIView。UIView 是我尝试制作一个自定义标题,它将是半透明的,因此 tableview 将通过它可见(我不确定这是否可能,因为我是新手,这是我的第一个 iPhone 应用程序)。

在处理了与我的 ViewController 类的所有连接后,当我运行代码时,我给了我这个错误:

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) 
(
"<NSAutoresizingMaskLayoutConstraint:0x8988060 h=--& v=--& V:[UIView:0x7574100(460)]>",
"<NSLayoutConstraint:0x7574780 V:|-(0)-[UIView:0x75742b0]   (Names: '|':UIView:0x7574100      )>",
"<NSLayoutConstraint:0x7574700 V:[UIView:0x75742b0]-(494)-|   (Names: '|':UIView:0x7574100)>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7574700 V:[UIView:0x75742b0]-(494)-|   (Names: '|':UIView:0x7574100     )>

Break on objc_exception_throw to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in   <UIKit/UIView.h> may also be helpful. 

关于为什么会发生这种情况的任何想法都会有所帮助。谢谢。

4

1 回答 1

2

您已经在界面构建器中配置了一个不可能的状态,正如消息所述,您所拥有的布局约束不能一次全部满足。由于您是新手,我建议禁用自动布局约束(转到文档选项卡 - 最左边的选项卡 - 在界面构建器中并取消选中自动布局)这将使您摆脱这个问题

是的,你可以有两个相互叠加的视图,你只需要使用 alpha 值来配置半透明

于 2012-12-26T15:42:59.270 回答