gpt4 book ai didi

ios - ✔ 勾选 UITableViewCell 中选定的行

转载 作者:IT王子 更新时间:2023-10-29 07:30:42 24 4
gpt4 key购买 nike

我是一名 iOS 开发新手。我想在我的 UITableViewCell 被选中时添加一个复选标记。选择另一行时,应删除复选标记。我该怎么做?

最佳答案

不要使用 [tableview reloadData];//它是一把锤子。

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath   *)indexPath
{
[tableView cellForRowAtIndexPath:indexPath].accessoryType = UITableViewCellAccessoryCheckmark;
}

-(void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView cellForRowAtIndexPath:indexPath].accessoryType = UITableViewCellAccessoryNone;
}

关于ios - ✔ 勾选 UITableViewCell 中选定的行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7982944/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com