0

我在一些动作事件上将单元格添加到 uitableview 中。单元格被添加到 uitableview 的顶部位置。我希望默认选择新添加的单元格。

4

1 回答 1

1

只需在添加单元格后调用表格视图的selectRowAtIndexPath:animated:scrollPosition:方法,假设单元格添加在第 0 节的索引 0 中:

NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
[tableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewRowAnimationTop]
于 2013-06-20T10:18:45.363 回答