だから私はチェックマークのアクセサリータイプのtableViewを持っていて、そのような方法があります:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSUInteger newRow = [lastIndexPath row];
NSUInteger oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1;
if (newRow != oldRow) {
UITableViewCell *newCell = [tableView cellForRowAtIndexPath:indexPath];
newCell.accessoryType = UITableViewCellAccessoryCheckmark;
UITableViewCell *oldCell = [tableView cellForRowAtIndexPath:lastIndexPath];
oldCell.accessoryType = UITableViewCellAccessoryNone;
lastIndexPath = indexPath;
}
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
最初は問題なく動作しているように見えますが、2 回目に行を選択すると、EXC_BAD_ACCESS と表示されて終了します。シミュレーターを 4.3 に切り替えると、行のみが選択され、機能しません。誰でも助けることができますか?