在ios中的uitableview中自定义单元格编辑样式 [英] customising cell editing style in uitableview in ios

查看:138
本文介绍了在ios中的uitableview中自定义单元格编辑样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户向右滑动时,我想提供两个选项.

I want to give two options when user swipe right direction.

具有名称编辑和删除的两个选项或按钮.

The two option or button with name edit and delete.

目前,仅当用户向左滑动UITableViewCellEditingStyleDelete时才显示删除

At present it is show only delete when user swipe left i.e UITableViewCellEditingStyleDelete

但是我想自定义此视图并给出两个带有灰色背景的按钮.目前它是红色背景.

But i want to customize this view and give two button with gray background.At present it is red background.

代码是:-

- (UITableViewCellEditingStyle)tableView:(UITableView *)aTableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{

    return UITableViewCellEditingStyleDelete;

   }

请帮助我实现这一目标.

Please help me how to acheive this.

推荐答案

您需要将UITableViewCell子类化并覆盖

You need to subclass UITableViewCell and override

setEditing:animated:
layoutSubviews

这应该可以预期的方式工作.

This should work in the expected way.

这篇关于在ios中的uitableview中自定义单元格编辑样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆