zoukankan      html  css  js  c++  java
  • 滑动cell 显示的按钮 类型分别是 删除 置顶 其他

    - (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];

    }

    1
  • 相关阅读:
    Selenium系列教程(2)
    如何清除浏览器缓存?
    菜鸟学自动化测试(一)----selenium IDE
    Python风格规范
    NSURLSession使用说明及后台工作流程分析
    iOS如何生成.a文件
    Apple移动设备处理器指令集 armv6、armv7、armv7s及arm64
    使用Xcode和Instruments调试解决iOS内存泄露
    Instruments使用实战
    正则表达式在iOS中的运用
  • 原文地址:https://www.cnblogs.com/fantasy3588/p/5776236.html
Copyright © 2011-2022 走看看