我想在 UITableView
完成初始化后将单元格号 0 设置为所选单元格?
我尝试这样做:
[cell setSelected:YES];
在
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
但是单元格颜色变成了黑色。
最佳答案
UITableView 本身可以管理选择。尝试调用:
- (void)selectRowAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated scrollPosition:(UITableViewScrollPosition)scrollPosition
关于objective-c - 在 UITableView 初始化中设置选定的单元格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11191656/