我搜索了几篇文章,但没有找到我想要的内容。基本上,我想在每一行上显示删除按钮,但我不想使用UITableView.editing属性。 因为它看起来像这样:
会有一个“编辑”按钮。当用户点击它时,删除按钮将会呈现滑动样式。
有没有可能像这样显示删除按钮:
也许有一些方法可以解决这个问题。否则,我将为此创建自定义视图。
感谢您的建议。
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
// Return YES if you want the specified item to be editable.
return YES;
}
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
//Do something...
}
}
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView
editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
return UITableViewCellEditingStyleDelete;
}