在 iOS 9 上,使用 UITableViewAutomaticDimension 设置我的 tableView,并在 viewDidLoad 上设置 200.festimatedRowHeight。
[self.tableView setEstimatedRowHeight:200.f];
[self.tableView setRowHeight:UITableViewAutomaticDimension];
它适用于带有图像、按钮或标签的单元格,但对于带有 textView 和按钮的单元格,按钮显示正确,但当我的 tableView 更新时,textView 不会展开。
[self.tableView beginUpdates];
NSIndexSet *indexSet = [NSIndexSet indexSetWithIndex:1];
[self.tableView reloadSections:indexSet withRowAnimation:UITableViewRowAnimationAutomatic];
[self.tableView endUpdates];
你对想要可能是我的错误有什么想法吗?
我应该在单元格中以编程方式更新高度约束吗?
谢谢
最佳答案
我找到了解决方案,我的 UITextView 设置为可滚动,我在 IB 中取消选中它,现在它可以工作了。
关于objective-c - UITableViewRowAnimationAutomatic 与 UITextView 无法正确显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34392074/