您的位置:首页 > 产品设计 > UI/UE

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

2015-09-22 17:31 423 查看
cell上显示多个操作,例如,删除,置顶

1.

滑动删除效果
-(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle
forRowAtIndexPath:(NSIndexPath *)indexPath{

 
}

2.文字操作
-(NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath
*)indexPath{

    UITableViewRowAction *action = [UITableViewRowAction
rowActionWithStyle:UITableViewRowActionStyleDefault
title:@"别删我"
handler:^(UITableViewRowAction *action,
NSIndexPath *indexPath) {
       
NSLog(@"删除");
    }];

    UITableViewRowAction *actionTwo = [UITableViewRowAction
rowActionWithStyle:UITableViewRowActionStyleDefault
title:@"置顶"
handler:^(UITableViewRowAction *action,
NSIndexPath *indexPath) {
       
NSLog(@"置顶删除");
    }];
     actionTwo.backgroundColor = [UIColor
grayColor];
   
return @[action,actionTwo];

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息