How can I make a custom view of the #39;delete-button#39; when performing commitEditingStyle within a UITableView(在 UITableView 中执行 commitEditingStyle 时,如何制作“删除按钮的自定义视图)
问题描述
我想自定义在表格视图单元格上执行向左滑动"操作时显示的删除按钮.我目前设置了 UITableViewCell 的子类,但还想自定义正在显示的删除按钮.
I would like to customize the delete button which is shown when performing the 'swipe to left'-action on a tableview cell. I currently set up a subclass of a UITableViewCell but also want to customize the delete-button which is being shown.
我的目标是在滑动时放置三个按钮.
My goal is to place three buttons when swiping.
我选择了另一种实现,我在每个单元格中使用 UIScrollview.
I choose for another implementation where I was using a UIScrollview in each cell.
http://www.teehanlax.com/blog/reproduce-the-ios-7-mail-apps-interface/
推荐答案
这可能对你有帮助.
- (void)willTransitionToState:(UITableViewCellStateMask)state
{
[super willTransitionToState:state];
if ((state & UITableViewCellStateShowingDeleteConfirmationMask) == UITableViewCellStateShowingDeleteConfirmationMask)
{
for (UIView *subview in self.subviews)
{
if ([NSStringFromClass([subview class]) isEqualToString:@"UITableViewCellDeleteConfirmationControl"])
{
UIImageView *deleteBtn = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 64, 33)];
[deleteBtn setImage:[UIImage imageNamed:@"arrow_left_s11.png"]];
[[subview.subviews objectAtIndex:0] addSubview:deleteBtn];
}
}
}
}
引用自:
自定义UITableView中的删除按钮
为uitableview创建自定义删除按钮
自定义删除按钮在 UITableView 单元格中编辑
这篇关于在 UITableView 中执行 commitEditingStyle 时,如何制作“删除按钮"的自定义视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 UITableView 中执行 commitEditingStyle 时,如何制作“删除按钮"的自定义视图


基础教程推荐
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01