首页 文章

UITextView的UITableViewRowAnimationAutomatic无法正确显示

提问于
浏览
2

在iOS 9上,使用UITableViewAutomaticDimension设置我的tableView,并在viewDidLoad上设置200.f estimatedRowHeight .

[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];

你有什么想法可能是我的错吗?

我应该在我的单元格中以编程方式更新heigth约束吗?

谢谢

1 回答

  • 2

    我找到了解决方案,我的UITextView被设置为可滚动,我在IB中取消选中它,现在它可以正常工作 .

相关问题