我想删除表中的行,当动作片删除按钮按下然后我写这样表行动表行的数据删除删除按钮按下
-(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
UIActionSheet *action=[[UIActionSheet alloc]initWithTitle:@"Are You Sure" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Delete", nil];
[action showInView:self.view];
}
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
NSString *buttontitle=[actionSheet buttonTitleAtIndex:buttonIndex];
if ([buttontitle isEqualToString:@"Delete"])
{
[self.map removeObjectAtIndex:indexpath.row];
//tableView is global object of your table view.
[tableView reloadData];
}
}
一个代码,但错误是“Undeclare标识符indexpath”
您还可以检查动作片标签内that.if(buttonIndex == 0){ // 这里访问的标签。 [self.map removeObjectAtIndex:action.tag] ;; [UITableView reloadData]; }而不是标题。 – iHulk 2014-09-30 07:44:13
但然后选择“刷新数据”未发现的错误没有已知的类方法是因为reloadData是一个对象类型的方法不是一个类类型为此,你需要使表对象全球化,所以,你可以访问它发生@IDeveloper – 2014-09-30 08:40:00
这里。我已经更新了我的答案再次检查。 – iHulk 2014-09-30 08:48:13