【问题标题】:Use NSLayoutConstraints in iOS6 to make a UITableView's footer, stick to the bottom of the last section and to the bottom of the UIScrollView?在iOS 6 中使用NSLayoutConstraints 做一个UITableView 页脚,粘到最后一节的底部和UIScrollView 的底部?
【发布时间】:2012-10-01 03:29:52
【问题描述】:

在 Interface Builder 中,当使用 UITableViewController 的表尾视图时,我添加了一个空白视图,似乎无法直接向它添加约束。

当我选择表格的页脚视图,然后选择一个约束时,所有的约束都是灰色的。这是一个错误还是(更有可能)我错误地假设您不能将表格页脚视图限制为 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

【问题讨论】:

    标签: uitableview uiscrollview table-footer nslayoutconstraint


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2012-07-14
      • 2017-08-23
      • 1970-01-01
      • 1970-01-01
      • 2013-01-18
      • 1970-01-01
      • 2012-10-03
      • 1970-01-01
      • 2015-12-18
      相关资源
      最近更新 更多