UITableViewCell,删除按钮框? [英] UITableViewCell, Delete Button Frame?

查看:79
本文介绍了UITableViewCell,删除按钮框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法改变在 UITableViewCells 上使用的滑动 [DELETE] 按钮的框架?目前它在单元格内垂直居中,但如果可能,我想移动到青色指南节目。

Is there a way to alter the frame of the "swipe" [DELETE] button used on UITableViewCells? Currently its centred vertically within the cell, but if possible I would like to move it down to the cyan guide show.

推荐答案

如果您正在寻找强真正的方式来解决这个问题,那么你应该子类 UITableViewCell 并覆盖所有状态处理方法正确绘制自己的删除按钮(不要调用超级在这些方法) 。但还有另一种简单的方法:

If you are looking for a strongly true way to solve this problem then you should to subclass of UITableViewCell and override the all state handling methods for correct drawing your own delete button (do not call super in those methods). But there is another easy way:

@implementation CustomCell
- (void)layoutSubviews {
       [super layoutSubviews];
       if (self.showingDeleteConfirmation) {
             if ([self.subviews count] < 4) return;
             UIView *delBtn = [self.subviews objectAtIndex:3];
             delBtn.frame = CGRectOffset(delBtn.frame, 0, 10);
       }
}
@end

这篇关于UITableViewCell,删除按钮框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆