ios零碎记录

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

2015-09-06  本文已影响788人  Pierre_
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{
}

上一篇下一篇

猜你喜欢

热点阅读