---- 解决办法 1、 找到UITableViewRowAction里面的字view,里面有一个button,我们加的文字就加在上面。 2、将图片设置为背景颜色 https://stackoverflow.com/questions/29421894/uitableviewrowaction-image-for-title func tableView (_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? { let deleteAction = UITableViewRowAction(style: .default, title: title) { (action, indexpath { let delete = UITableViewRowAction(style: .normal, title: "删除") { _, index in }
---- 解决办法 1、 找到UITableViewRowAction里面的字view,里面有一个button,我们加的文字就加在上面。 ? 2、将图片设置为背景颜色 https://stackoverflow.com/questions/29421894/uitableviewrowaction-image-for-title func tableView (_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? { let deleteAction = UITableViewRowAction(style: .default, title: title) { (action, indexpath { let delete = UITableViewRowAction(style: .normal, title: "删除") { _, index in }
NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewRowAction *action0 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleNormal title:@"关注" handler :^(UITableViewRowAction *action, NSIndexPath *indexPath) { NSLog(@"点击了关注"); // 收回左滑出现的按钮 (退出编辑模式) tableView.editing = NO; }]; UITableViewRowAction *action1 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"删除" handler:^(UITableViewRowAction *action
weakCell = [tableView cellForRowAtIndexPath:indexPath]; __weak typeof(self) weakSelf = self; UITableViewRowAction *action = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"删除" handler :^(UITableViewRowAction *action, NSIndexPath *indexPath) { [tableView beginUpdates];
NSIndexPath *)indexPath { ChatItem *chatItem = self.chatItems[indexPath.row]; // 置顶/取消置顶 UITableViewRowAction *topAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleNormal title: @"取消置顶" : @"置顶" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath *deleteAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"删除" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath
imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) (NSArray<UITableViewRowAction *> *)tableView:(UITableView
titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath; 下面这个方法是IOS8中的新方法,用于自定义创建tableView被编辑时右边的按钮,按钮类型为UITableViewRowAction
Actions) 在iOS8之后,苹果官方增加了UITableVIew的右滑操作接口,即新增了一个代理方法(tableView: editActionsForRowAtIndexPath:)和一个类(UITableViewRowAction ),代理方法返回的是一个数组,我们可以在这个代理方法中定义所需要的操作按钮(删除、置顶等),这些按钮的类就是UITableViewRowAction。
Actions) 在iOS8之后,苹果官方增加了UITableVIew的右滑操作接口,即新增了一个代理方法(tableView: editActionsForRowAtIndexPath:)和一个类(UITableViewRowAction ),代理方法返回的是一个数组,我们可以在这个代理方法中定义所需要的操作按钮(删除、置顶等),这些按钮的类就是UITableViewRowAction。
Actions) 在iOS8之后,苹果官方增加了UITableVIew的右滑操作接口,即新增了一个代理方法(tableView: editActionsForRowAtIndexPath:)和一个类(UITableViewRowAction ),代理方法返回的是一个数组,我们可以在这个代理方法中定义所需要的操作按钮(删除、置顶等),这些按钮的类就是UITableViewRowAction。
Swipeable Cell.gif 我学到了 简单起见,我用Project 13的代码基础上进行修改,换了个清爽的绿色:) 实现editActionsForRowAt这个delegate方法,返回值是Array<UITableViewRowAction >,新建几个你需要的功能返回即可 每一个Action直接通过UITableViewRowAction的init方法新建即可。