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

UITableView的cell向左滑出有删除,修改等选项

2016-04-01 17:02 423 查看
效果图:



只需实现UITableView Delegate的一种方法即可:

- (NSArray<UITableViewRowAction *> *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewRowAction *modifyAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleNormal title:@"修改" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {

}];
modifyAction.backgroundColor = MC_Color_DeepGray;
UITableViewRowAction *deleteAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleNormal title:@"删除" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {

}];
deleteAction.backgroundColor = MC_Color_StandRed;
return @[ modifyAction,deleteAction];
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: