美文网首页
UITableView默认选中第一行,以及获取当前选中的cell

UITableView默认选中第一行,以及获取当前选中的cell

作者: 未来可期me | 来源:发表于2018-07-11 11:48 被阅读20次

//默认选中TableView第一行,没有动画及滚动效果,动画即滚动效果通过animated,position来设定

[_leftTableview selectRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] animated:NO scrollPosition:UITableViewScrollPositionNone];

//获取当前选中的cell

NSIndexPath *indexPath = [_leftTableview indexPathForSelectedRow];

UITableViewCell *cell = [_leftTableview cellForRowAtIndexPath:indexPath];

注意,在cellForRowAtIndexPath方法中是实现不了的

相关文章

网友评论

      本文标题:UITableView默认选中第一行,以及获取当前选中的cell

      本文链接:https://www.haomeiwen.com/subject/pwqhpftx.html