- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
_lastIndex = [NSIndexPath indexPathForRow:0 inSection:0];
[_tableV selectRowAtIndexPath:_lastIndex animated:YES scrollPosition:UITableViewScrollPositionTop];
NSIndexPath *path = [NSIndexPath indexPathForItem:0 inSection:0];
[self tableView:self.tableV didSelectRowAtIndexPath:path];
}
- (void)viewDidLoad {
[super viewDidLoad];
// _lastIndex.row = 0;
// Do any additional setup after loading the view, typica

本文介绍如何在Swift中使用UITableView实现单选功能,并确保应用程序启动时第一行被默认选中。通过设置indexPath和cell的accessoryType来实现选中效果,并在用户点击其他行时更新选中状态。
最低0.47元/天 解锁文章
628

被折叠的 条评论
为什么被折叠?



