2013-07-10 119 views
0

我想上面添加UITableView的一個UIView添加一個UIView以上的UITableView,更換導航欄: enter image description here無法從故事板

這是控制器是如何構成的: enter image description here

這裏是控制檯輸出:

2013-07-10 00:54:54.361 WeatherSX[15225:c07] 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) 
(
    "<NSLayoutConstraint:0x9965880 V:|-(0)-[UIView:0x9964960] (Names: '|':UIView:0x9964900)>", 
    "<NSLayoutConstraint:0x99657e0 V:[UIView:0x9964960]-(NSSpace(8))-[UITableView:0x902ca00]>", 
    "<NSLayoutConstraint:0x9964b00 V:[UITableView:0x902ca00(469)]>", 
    "<NSLayoutConstraint:0x9965720 UITabBar:0x9960fd0.bottom == UIView:0x9964900.bottom>", 
    "<NSLayoutConstraint:0x99656e0 V:[UITableView:0x902ca00]-(0)-[UITabBar:0x9960fd0]>", 
    "<NSAutoresizingMaskLayoutConstraint:0x81762a0 h=--& v=--& V:[UIView:0x9964900(460)]>" 
) 

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x9964b00 V:[UITableView:0x902ca00(469)]> 

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. 

問題是什麼?之前從未遇到這樣的錯誤。 謝謝你的幫助。

+1

關閉自動佈局 –

+0

您可以回答問題,然後我會接受它。它正在工作!謝謝。 (我必須閱讀關於該自動佈局)。 – androniennn

+0

哈哈好涼爽謝謝..生病發布答案現在 –

回答

1

您需要刪除故事板內的AutoLayout。選擇viewController,然後選擇最左邊的選項卡。去除AutoLayout旁邊的複選標記。然後你就不會再有約束錯誤了!

0

步驟1) 創建一個標題視圖爲:在Window not view controller上添加此視圖,將outlet設置爲該視圖。 @property(nonatomic,strong)IBOutlet UIView * viewTop;

setp 2) 在viewDidLoad上添加以下單行代碼 [self.tableview setTableHeaderView:self.viewTop];