首页 > 其他 > 详细

滑动cell 显示的按钮 类型分别是 删除 置顶 其他

时间:2016-08-16 14:36:16      阅读:152      评论:0      收藏:0      [点我收藏+]

- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath

{

        //删除按钮

        UITableViewRowAction *deleteRowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"删除" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath){

                [_dataArray removeObjectAtIndex:indexPath.row];

                [tableView deleteRowsAtIndexPaths:@[indexPath]withRowAnimation:UITableViewRowAnimationAutomatic];

            }];

         

     

        //置顶按钮

        UITableViewRowAction *toTopRowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"置顶" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath){

                 

                NSLog(@"置顶");

                 

            }];

        toTopRowAction.backgroundColor = [UIColor orangeColor];

         

        //其他按钮

        UITableViewRowAction *otherRowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"其他" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath){

                NSLog(@"其他");

            }];

     

        otherRowAction.backgroundColor = [UIColor lightGrayColor];

     

        //返回按钮数组

        return @[deleteRowAction, toTopRowAction, otherRowAction];

}

 

滑动cell 显示的按钮 类型分别是 删除 置顶 其他

原文:http://www.cnblogs.com/fantasy3588/p/5776236.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!