iPhone开发人员:滑动UITableCell [英] iPhone Dev: Swipe a UITableCell

查看:98
本文介绍了iPhone开发人员:滑动UITableCell的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一个程序如何滑动UITableCell的能力.我已经有一个与UITableCell一起使用的子类.我是否可以像查看视图一样处理其中的滑动操作?

How does one program the ability to swipe a UITableCell. I already have a subclass that I've been working with of UITableCell. Do I just handle swipes in it, like I would a view?

推荐答案

您将需要实现此方法:

tableView:editingStyleForRowAtIndexPath:

并返回UITableViewCellEditingStyleDelete

要使其正常工作,您还需要实现以下方法:

To make it work you'll also want to implement these methods:

tableView:commitEditingStyle:forRowAtIndexPath:
tableView:canEditRowAtIndexPath:

要自定义删除按钮的文本,请参见以下线程: UITableView滑动以删除:如何自定义按钮和动作?

To customize the text of the delete button see this thread: UITableView Swipe to delete: how to customize button and action?

这篇关于iPhone开发人员:滑动UITableCell的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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