2016-12-14 71 views
0

我试图使用XIB文件 实施的UITableView但是当我运行应用程序时,我收到以下错误&的厦门国际银行是正常的小屏幕一样的iPhone4s
它在较大的显示器尺寸下工作正常无法同时满足约束条件当试图加载厦门国际银行文件

Screenshot of xib

任何帮助将不胜感激

错误

2016-12-14 17:12:41.826 FoodStrock[5776:1761262] 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. 
(
    "<NSLayoutConstraint:0x7fcc2a6dfac0 V:[UIImageView:0x7fcc2a6e1010(63)]>", 
    "<NSLayoutConstraint:0x7fcc2a617530 V:[UIImageView:0x7fcc2a6e1010]-(8)-| (Names: '|':UITableViewCellContentView:0x7fcc2a6e1270)>", 
    "<NSLayoutConstraint:0x7fcc2a6cc3b0 V:|-(9)-[UIImageView:0x7fcc2a6e1010] (Names: '|':UITableViewCellContentView:0x7fcc2a6e1270)>", 
    "<NSLayoutConstraint:0x7fcc2a4955a0 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x7fcc2a6e1270(59.6667)]>" 
) 

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7fcc2a6dfac0 V:[UIImageView:0x7fcc2a6e1010(63)]> 

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. 
2016-12-14 17:12:41.827 FoodStrock[5776:1761262] 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. 
(
    "<NSLayoutConstraint:0x7fcc2a6a69d0 V:[UILabel:0x7fcc2a6e1670'Address'(63)]>", 
    "<NSLayoutConstraint:0x7fcc2a693820 UILabel:0x7fcc2a6e1670'Address'.bottom == UITableViewCellContentView:0x7fcc2a6e1270.bottomMargin>", 
    "<NSLayoutConstraint:0x7fcc2a6e0c00 UILabel:0x7fcc2a6e1670'Address'.top == UITableViewCellContentView:0x7fcc2a6e1270.topMargin + 1>", 
    "<NSLayoutConstraint:0x7fcc2a4955a0 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x7fcc2a6e1270(59.6667)]>" 
) 
+0

正确检查您的约束条件。由于额外的限制,错误正在发生。检查每个约束并删除不必要的约束。 –

回答

0

把你的UIImageView,的UILabel,UIButton的单一的UIView(说MAINVIEW)。现在,mainView约束将从xib视图(superView)引导,尾随,顶部底部。现在UIImageView,UILabel,UIButton的约束是根据您的要求w.r.t. MAINVIEW。

注意:尽可能少地限制UIComponents,但请注意满足您的要求。喜欢这里,给约束这样的:

  1. 的UIImage:顶部,底部,领先WRT MAINVIEW和宽度不变,或者你可以到容器水平给中心领导,高度,宽度。 UIButton:顶部,底部,尾部wrt mainView和常量宽度,或者您可以水平居中给容器,领先,高度,宽度。

  2. UILabel:领先的后面和水平居中的容器是足够的,但你也可以给高度。 UILabel可以根据您刚才需要指定x和y坐标的文本字体大小自动获取高度和宽度。

+0

感谢Tinu的帮助,但我无法在xib文件中找到UIView –

+0

老兄,您必须添加新的UIView,右下方的故事板,拖放它。然后把所有的组件放进去然后使用它。 –

相关问题