美文网首页
开发记录:UITableView默认选中第一行。

开发记录:UITableView默认选中第一行。

作者: Jacky__燊 | 来源:发表于2019-01-07 17:04 被阅读0次

度娘上有很多都介绍了默认选中第一行的方法。关键在于这个方法写到哪儿才会生效,不然即便copy、past也没用。

            [self.YourTableView reloadData];
            
            NSIndexPath *ip=[NSIndexPath indexPathForRow:0 inSection:0];
            
            [self.YourTableView selectRowAtIndexPath:ip animated:YES scrollPosition:UITableViewScrollPositionBottom];

写到 UITableView的ReloadData方法之后才管用哦。

相关文章

网友评论

      本文标题:开发记录:UITableView默认选中第一行。

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