【发布时间】:2012-05-05 15:39:14
【问题描述】:
当用户决定删除 UITableViewCell 时,会出现第二个确认对话框。这是我正常状态下的表格视图:
这是整个表格进入编辑模式的时候:
现在,当用户点击左侧的红色减号之一时,单元格将进入删除确认模式:
如果用户随后点击刚刚出现的删除按钮,则会出现此操作表:
这就是问题出现的地方。如果用户确认他们要删除地图,一切都很好。但是如果按下取消按钮,操作表就会消失,但表格视图仍然是这样的:
问题是删除确认按钮不应再处于其选定状态,并且应该隐藏自身。正如你所看到的,它没有。我在文档中的搜索已经结束,没有结果。我不想setEditing:NO,因为我希望表格保持正常的编辑状态。有什么想法吗?
编辑1:这是tableView:commitEditingStyle:forRowAtIndexPath:内部发生的事情
- (void)tableView:(UITableView*)tableView commitEditingStyle:
(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath*)indexPath {
NSInteger finalIndex = [self getFinalIndexForIndexPath:indexPath];
NSString* mapTitle = ((PreviewDataObject*)[[[SingletonDataController sharedSingleton]
getImportedOrSavedMapPreviews:masterIdentifierString]
objectAtIndex:finalIndex]).titleString;
UIActionSheetWithIndexPath* sheet = [[UIActionSheetWithIndexPath alloc] initWithTitle:
[NSString stringWithFormat:@"Are you sure you want to delete the map '%@'?",
mapTitle] delegate:self cancelButtonTitle:@"Cancel"
destructiveButtonTitle:@"Delete Map" otherButtonTitles:nil];
sheet.indexPath = indexPath;
[sheet showFromTabBar:[AppDelegate appDelegate].tabBarController.tabBar];
[sheet release];
}
【问题讨论】:
-
你可以显示代码 - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
-
你能告诉我们你的数组名称是什么吗?
-
在
commitEditingStyle,我实际上并没有做任何删除;我只是展示了提示用户是否真的想要删除地图的操作表。
标签: ios user-interface uitableview editing