2013-07-10 123 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];