您的位置:首页 > 移动开发 > IOS开发

iOS TableView 默认选中某行

2016-02-22 18:16 330 查看
在开发中我们经常会遇到这样的需求,就是在一个页面操作进入下一个页面时,要默认的选中该页面某行;

通常写在viewWillAppear里面或者在[tableView reloaData]之后
NSIndexPath * selIndex = [NSIndexPath indexPathForRow:1 inSection:0];
[_tableView selectRowAtIndexPath:selIndex animated:YES scrollPosition:UITableViewScrollPositionTop];
NSIndexPath * path = [NSIndexPath indexPathForItem:1 inSection:0];
[self tableView:self.tableView didSelectRowAtIndexPath:path];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: