您的当前位置:首页正文

ios设置tableview默认选中某行并实现点击某行的效果

来源:图艺博知识网

tableView加载出来默认选中某一行:(默认第一行)

//设置选中第一行(默认有蓝色背景)

[self.tableView selectRowAtIndexPath:[NSIndexPath indexPathForItem:0 inSection:0] animated:YES scrollPosition:UITableViewScrollPositionTop];

---------------------------------分割线----------------------------------

tableView加载出来后默认点击某一行:(默认第一行)

//实现点击第一行所调用的方法

[self tableView:self.tableView didSelectRowAtIndexPath:[NSIndexPath indexPathForItem:0 inSection:0]];

Top