ios设置tableview默认选中某行并实现点击某行的效果
2016-11-04 本文已影响1915人
爱iOS的延哥
tableView加载出来默认选中某一行:(默认第一行)
//设置选中第一行(默认有蓝色背景)
[self.tableView selectRowAtIndexPath:[NSIndexPath indexPathForItem:0 inSection:0] animated:YES scrollPosition:UITableViewScrollPositionTop];
---------------------------------分割线----------------------------------
tableView加载出来后默认点击某一行:(默认第一行)
//实现点击第一行所调用的方法
[self tableView:self.tableView didSelectRowAtIndexPath:[NSIndexPath indexPathForItem:0 inSection:0]];