Customize the delete button in UITableView(自定义 UITableView 中的删除按钮)
本文介绍了自定义 UITableView 中的删除按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有滑动删除"TableViewCell
的功能.我想自定义删除按钮.
I have the functionality for "Swipe to delete" the TableViewCell
. I want to customize the Delete button.
这可能吗?如何访问删除按钮?
Is this possible, and how to access the Delete button ?
推荐答案
当用户执行滑动操作时会调用该方法
只需将其放在您的 CustomCell 中
- (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];
}
}
}
}
你不应该这样尝试,你不应该改变 Apple 的默认视图.
这篇关于自定义 UITableView 中的删除按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
沃梦达教程
本文标题为:自定义 UITableView 中的删除按钮


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