Ios 如何显示EditActionsforrowatineXPath';单击单元格上的UITableviewCell的按钮
我使用了Ios 如何显示EditActionsforrowatineXPath';单击单元格上的UITableviewCell的按钮,ios,objective-c,uitableview,Ios,Objective C,Uitableview,我使用了editactionsforrowatinedxpath添加自定义UITableViewRowAction 我想自动拖动以显示这两个选项(Delete&Cancel),只需单击UITableViewCell(didselectrowatinexpath) 当前,从右向左拖动单元格是可行的,但如何在不拖动的情况下显示(只需单击单元格上的任何按钮) 是否有任何方法显示特定单元格的此选项 例如 我的代码: -(NSArray<UITableViewRowAction *> *)t
editactionsforrowatinedxpath
添加自定义UITableViewRowAction
我想自动拖动以显示这两个选项(Delete
&Cancel
),只需单击UITableViewCell
(didselectrowatinexpath)
当前,从右向左拖动单元格是可行的,但如何在不拖动的情况下显示(只需单击单元格上的任何按钮)
是否有任何方法显示特定单元格的此选项
例如
我的代码:
-(NSArray<UITableViewRowAction *> *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewRowAction *deleteAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleNormal title:@"Delete" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath){
// delete action
}];
deleteAction.backgroundColor = [UIColor redColor];
UITableViewRowAction *cancelAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleNormal title:@"Cancel" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath){
//cancel action
}];
return @[deleteAction, cancelAction];
}
-(NSArray*)表视图:(UITableView*)表视图编辑操作ErrorWatIndeXPath:(NSIndexPath*)indexPath
{
UITableViewRowAction*deleteAction=[UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleNormal标题:@“删除”处理程序:^(UITableViewRowAction*action,NSIndexPath*indexPath){
//删除操作
}];
deleteAction.backgroundColor=[UIColor redColor];
UITableViewRowAction*cancelAction=[UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleNormal标题:@“取消”处理程序:^(UITableViewRowAction*action,NSIndexPath*indexPath){
//取消操作
}];
return@[deleteAction,cancelAction];
}
注意:无需使用自定义设计。可能与手机上的Try call重复
setEditing:YES动画:YES