2016-12-14 38 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,右下方的故事板,拖放它。然後把所有的組件放進去然後使用它。 –