UITableView新增特性类似于qq(置顶--删除)

来源:互联网 发布:seo软件工具 编辑:程序博客网 时间:2024/06/03 23:39

cell上显示多个操作,例如,删除,置顶

1.

滑动删除效果

-(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath{

 

}

2.文字操作

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

    UITableViewRowAction *action = [UITableViewRowActionrowActionWithStyle:UITableViewRowActionStyleDefaulttitle:@"别删我"handler:^(UITableViewRowAction *action,NSIndexPath *indexPath) {

       NSLog(@"删除");

    }];

    UITableViewRowAction *actionTwo = [UITableViewRowActionrowActionWithStyle:UITableViewRowActionStyleDefaulttitle:@"置顶"handler:^(UITableViewRowAction *action,NSIndexPath *indexPath) {

       NSLog(@"置顶删除");

    }];

     actionTwo.backgroundColor = [UIColorgrayColor];

   return @[action,actionTwo];


}


0 0