我遵循了使用UITableView
. 完成的代码
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if(editingStyle == UITableViewCellEditingStyleDelete)
{
Message *message = [messageList objectAtIndex:indexPath.row];
[self.persistencyService deleteMessagesFor:message.peer];
[messageList removeObject:message];
[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationLeft];
}
}
我的问题是:@[indexPath]
做什么?是一样的吗?:
[NSArray arrayWithObject:indexPath]