gpt4 book ai didi

ios - 将 UITableViewCell 恢复到正常编辑模式

转载 作者:可可西里 更新时间:2023-11-01 05:57:28 24 4
gpt4 key购买 nike

当用户决定删除 UITableViewCell 时,我会出现第二个确认对话框。这是我的正常状态下的表格 View :

Normal


这是整个表格进入编辑模式的时候:

Normal editing mode


现在,当用户点击左侧的红色减号之一时,单元格进入删除确认模式:

Delete confirmation mode


如果用户随后点击刚刚出现的删除按钮,则会出现此操作表:

Second confirmation


这就是问题所在。如果用户确认他们想要删除 map ,那么一切都很好。但是如果按下取消按钮,操作表就会消失,但表格 View 仍然是这样的:

The delete confirmation button should no longer be in its selected state, and should have hidden itself from view

问题是删除确认按钮不应再处于选中状态,而应隐藏在 View 之外。如您所见,它没有。我在文档中的搜索没有结果。我不想 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];
}

最佳答案

在那之后,您还可以呈现一个 AlertView,询问他们是否真的、真的、真的想要删除。

打开按钮然后按删除的两步过程应该足以确认。

在我看来,做你正在做的事情并不是标准做法,一旦你进入那个领域,你就会发现框架中的漏洞。

关于ios - 将 UITableViewCell 恢复到正常编辑模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10463374/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com