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

查看:31
本文介绍了自定义删除按钮在 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天全站免登陆