我有滑动删除"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 中的删除按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!