【发布时间】:2013-05-22 10:38:11
【问题描述】:
我有一个动态表,用户可以在其中添加和删除数据。该表显示购物清单。如果购物完成,用户应该能够勾选所需的项目并且也应该能够取消勾选,我通过设置附件按钮来实现这一点。但是,当我从中删除一行时,问题就来了,单元格被删除,但是附加到该单元格的附件按钮保持在相同的状态。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
cell = [tableView cellForRowAtIndexPath:indexPath];
if (cell.accessoryView == nil)
{
cell.accessoryView= [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"tick_btn"]]; } else { cell.accessoryView = nil;
}
}
【问题讨论】:
-
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {cell = [tableView cellForRowAtIndexPath:indexPath]; if (cell.accessoryView == nil) { cell.accessoryView= [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"tick_btn"]]; } else { cell.accessoryView = nil; } }
标签: ios uitableview uinavigationitem accessoryview