ios - ✔ 勾选 UITableViewCell 中选定的行

标签 ios uitableview

我是一名 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/

相关文章:

ios - 当 View Controller 内部有 ScrollView 时处理键盘事件

ios - 为什么定时器/倒计时总是在 UITableViewCell 中重置为初始值

ios - 在 UITextView 中检测点击的字符串

ios - 让线程进入休眠状态但保持动画继续 - 这可能吗?

ios - 自定义标题有零导出

c# - PushSharp 异常 : The credentials supplied to the package were not recognized

ios - 用户触摸后线路旋转

uitableview - 为什么事件指示器显示两次

ios - 在UIAutomation测试iOS中访问APNS通知

使用 Swift 和 NSURLSession 固定 iOS 证书