-(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath{
}
-(BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath{
return YES;
}
-(NSArray<UITableViewRowAction*>*)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewRowAction *rowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:NSLocalizedStringFromTableInBundle(Unblock_Lb_Title, nil, [[LanguageTool getInstance] getLocaleBundle], @"") handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
NSLog(@"Delete");
[self showUnblockAlert:indexPath];
}];
rowAction.backgroundColor = [[UIStyleUtil getInstance]getRedColor];
NSArray *arr = @[rowAction];
return arr;
}
参考:
1.https://stackoverflow.com/questions/31739505/gif-crashing-on-ios-device?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
本文介绍如何在iOS应用中使用UITableView实现删除操作。具体包括设置表格视图允许编辑、定义编辑样式以及自定义编辑操作按钮样式等步骤。通过代码示例展示了如何响应用户删除操作,并提供了一个简单的警告提示框来确认用户的删除行为。
3395

被折叠的 条评论
为什么被折叠?



