定位tableview的某一行 并选中

2017-09-29  本文已影响0人  奕珃

//例子:选中section 0中的第5行

NSIndexPath *indexpath = [NSIndexPath indexPathForRow:5 inSection:0];

[self.tableView scrollToRowAtIndexPath:indexpath atScrollPosition:UITableViewScrollPositionMiddle animated:YES];  //滚动到第5行

[self.tableView selectRowAtIndexPath:indexpath animated:YES scrollPosition:UITableViewScrollPositionMiddle];  //选中第5行

上一篇 下一篇

猜你喜欢

热点阅读