我遇到了以下问题。
我有一个使用带有自定义 UITableViewCell 的 UITableView 的应用程序。由于应用程序的规范,我需要它始终处于编辑模式,所以在 viewDidLoad 上我这样写:
- (void)viewDidLoad
{
MainTableView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"compose_background.png"]];
[MainTableView setAllowsSelectionDuringEditing: TRUE];
[MainTableView setEditing: TRUE];
[super viewDidLoad];
}
此外,我还实现了以下方法:
- (UITableViewCellEditingStyle) tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
- (BOOL) tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
- (void) tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
还有几个,但问题仍然存在,当我滑动单元格时,删除按钮没有出现。任何指针将不胜感激。
最佳答案
- (UITableViewCellEditingStyle) tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
必须为要删除的每一行返回 UITableViewCellEditingStyleDelete
。在编辑模式下禁用滑动删除以支持此方法。
关于ios - 在编辑模式下滑动删除不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9455173/