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

iOS开发--UITableViewCell侧滑多个按钮(系统仅支持iOS8以上)

2015-11-23 20:30 603 查看
/**
*  block里面是点击方法 , 这个委托是ios8之后的才有,如果项目只适配ios8以上就可以不用自己写按钮了。返回值是 UITableViewRowAction 的数组
*/
-(NSArray<UITableViewRowAction*>*)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewRowAction *rowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault
title:@"删除"
handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
NSLog(@"删除");
}];
UITableViewRowAction *rowActionSec = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault
title:@"更多"
handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
NSLog(@"更多");
}];
rowActionSec.backgroundColor = [UIColor greenColor];
NSArray *arr = @[rowAction,rowActionSec];
return arr;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: