uitableview - 在iOS 6中使用NSLayoutConstraints制作UITableView页脚,粘在最后一节的底部和UIScrollView的底部?

标签 uitableview uiscrollview table-footer nslayoutconstraint

在 Interface Builder 中,当使用 UITableViewController 的表页脚 View (我向其中添加了空白 View )时,似乎不可能直接向其添加约束。

当我选择表的页脚 View ,然后选择一个约束时,所有约束都显示为灰色。这是一个错误还是(更有可能)我错误地假设您无法将表页脚 View 约束到 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

最佳答案

我也得到了同样的error但在你的情况下尝试 临时修复: 禁用自定义单元Xib中的自动布局,然后构建

关于uitableview - 在iOS 6中使用NSLayoutConstraints制作UITableView页脚,粘在最后一节的底部和UIScrollView的底部?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12823095/

相关文章:

xcode - 读取 UITableView Section Title 的字符串值

ios - UITableview 从上一个 View 返回时更改 Y 位置

ios - 从 URL 加载的图像在 UITableView 滚动时发生变化

ios - UIScrollView setContentOffset :animated: weird behaviour

css - 当 TABLE 跨越多个页面时,如何使第一页上的 TFOOT 显示为 "continued..."?

ios - 滚动 UITableView 以关闭 UIView Above

ios - UIScrollView 编程滚动不起作用 iOs 8

ios - 你如何在 ScrollView 中居中显示内容?

html - 在每个打印页面上重复 HTML 表格页脚

uitableview - 在 Xamarin.iOS 中的 UITableView 末尾添加自定义页脚