自定义删除按钮在UITableView单元格中编辑 [英] Custom Delete button On Editing in UITableView Cell

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

问题描述

我已经通过了这个问题显示以下代码:

I have gone through this question that shows the following code:

-(NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath{
    return @"Sagar";
}

如果我想要自定义图像而不是默认的红色按钮怎么办?

What if I want a custom image instead of the default red button?

推荐答案

luvieere是对的 - 如果你想要同样的删除比喻,你想把它保存在Apple提供的红色按钮上。为什么改变它?它在全球范围内被认为是删除按钮的标准

luvieere is right -- if you want that same "delete" metaphor, you want to keep it at the red button that Apple provides. Why change it? Its globally recognizable as the standard for delete buttons.

虽然,如果你想要像Tweetie这样的东西,你完全改变滑动的行为,你可以使用像你自己的视图中绘制的ABTableViewCell。创建自定义表视图,覆盖-touchesBegan:withEvent:,并检查触摸。计算两个触摸的增量(在touchesMoved:withEvent :)并移动您自己的视图。

Although, if you want something like Tweetie, where you completely change the behavior of swiping, you could use something like ABTableViewCell where you just draw in your own view. Make a custom table view, override -touchesBegan:withEvent:, and check for touches. Calculate the delta of the two touches (in touchesMoved:withEvent:) and move your own view around.

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

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