3

在界面構建器中,當使用UITableViewController的表底視圖(我添加了空白視圖)時,似乎不可能直接向其添加約束。在iOS6中使用NSLayoutConstraints創建一個UITableView的頁腳,並粘在最後一部分的底部和UIScrollView的底部?

當我選擇表格的頁腳視圖,然後選擇一個約束時,所有的約束都變灰了。這是一個錯誤或(更可能),我在錯誤的假設,你不能約束一個表頁腳視圖,爲UIScrollView

----- -----編輯

另外,我有試圖代碼添加此...

[self.tableView.tableFooterView setTranslatesAutoresizingMaskIntoConstraints:NO]; 

//  Setup constraints 
// 
NSDictionary *viewsDictionary = @{@"superView" : self.view, @"tableView" : self.tableView, @"tableFooterView" : self.tableView.tableFooterView}; 

//   Footer 
// 
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[tableFooterView]|" 
                         options:0 
                         metrics:nil 
                         views:viewsDictionary]]; 

但我只是得到這個輸出:

2012-10-10 16:29:04.606 myApp[632:c07] *** Assertion failure in -[UITableView layoutSublayersOfLayer:], /SourceCache/UIKit_Sim/UIKit-2372/UIView.m:5776 
2012-10-10 16:29:04.608 myApp[632:c07] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Auto Layout still required after executing -layoutSubviews. UITableView's implementation of -layoutSubviews needs to call super.' 
*** First throw call stack: 
(0x199b012 0x17c0e7e 0x199ae78 0x1256f35 0x7589ef 0x17d46b0 0x622fc0 0x61733c 0x622eaf 0x7f78cd 0x7401a6 0x73ecbf 0x73ebd9 0x73de34 0x73dc6e 0x73ea29 0x741922 0x7ebfec 0x738bc4 0x738dbf 0x738f55 0x741f67 0x705fcc 0x706fab 0x718315 0x71924b 0x70acf8 0x27e8df9 0x27e8ad0 0x1910bf5 0x1910962 0x1941bb6 0x1940f44 0x1940e1b 0x7067da 0x70865c 0x6d4d 0x2615) 
libc++abi.dylib: terminate called throwing an exception 

回答

0

我也得到了同樣的error但在你的情況下嘗試 Temp Fix: 禁用自定義單元格Xib中的autoLayout,然後生成