美文网首页 ios零碎记录
IOS UITabelView cell添加多选按钮(ios8)

IOS UITabelView cell添加多选按钮(ios8)

作者: Pierre_ | 来源:发表于2015-09-06 11:39 被阅读788次
    A016204A-3748-4A61-92B6-9B2CA48513DC.jpg DB9B3B7B-7CE3-4A94-AE70-F093349687A4.jpg
    - (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath NS_AVAILABLE_IOS(8_0) {
        UITableViewRowAction *dele = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"删除" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
            NSLog(@"点击了删除");
        }];
        UITableViewRowAction *top = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"操作1" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
            NSLog(@"操作1");
        }];
        UITableViewRowAction *le = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"操作2" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
            NSLog(@"操作2");
        }];
        UITableViewRowAction *tp = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"操作3" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
            NSLog(@"操作3");
        }];
           dele.backgroundColor = [UIColor redColor];
        top.backgroundColor = [UIColor grayColor];
        le.backgroundColor = [UIColor orangeColor];
        tp.backgroundColor = [UIColor blueColor];
        
        return @[dele, le, tp, top];
    }
    -(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath{
    }
    
    

    相关文章

      网友评论

        本文标题:IOS UITabelView cell添加多选按钮(ios8)

        本文链接:https://www.haomeiwen.com/subject/dzcrcttx.html