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 时,如何制作“删除按钮"的自定义视图


- 网上有没有好的 UIScrollView 教程? 2022-01-01
- 如何在 iPhone 模拟器中重置 NSUserDefaults 数据? 2022-01-01
- 使用自动布局向 UIScrollView 添加动态大小的视图 2022-01-01
- GPS状态的广播接收器? 2022-01-01
- UITextView 内容插图 2022-01-01
- 类似于 Mail.app 的 iPad 模态视图控制器? 2022-01-01
- URL编码Swift iOS 2022-01-01
- 在 Iphone SDK 的导航栏上添加多个按钮 2022-01-01
- Xcode 7.3 中带有 UILabel 的 UIStackView 2022-01-01
- SetOnItemSelectedListener上的微调程序错误 2022-01-01