iphone - UITableViewCell,删除按钮框架?

标签 iphone objective-c cocoa-touch uitableview

有没有办法改变 UITableViewCells 上使用的“滑动”[DELETE] 按钮的框架?目前它在单元格内垂直居中,但如果可能的话我想将它向下移动到青色引导显示。

enter image description here

最佳答案

如果您正在寻找一种非常真实的方法来解决这个问题,那么您应该继承 UITableViewCell 并覆盖所有状态处理方法以正确绘制您自己的删除按钮(不要在那些方法)。但还有另一种简单的方法:

@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

关于iphone - UITableViewCell,删除按钮框架?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6861431/

相关文章:

ios - 单击按钮时如何激活 UISearchDisplayController

ios - 如何检测点击 UITableView 的清晰部分?

iphone - 如何在旋转前检测 iPhone 方向

ios - 如何检测iphone是否处于静音模式

iphone - 什么会导致此 SIGSEGV 错误?

iphone - 保持同一应用程序的 android 和 iphone 版本的最佳策略是什么

iphone - 有一个按钮来触发 EGORefreshTableHeaderView

ios - Swift 字典,读取键值 - 推送通知

objective-c - NSNumber 返回与原始 int 不同的值

iphone - 使用 NSURLConnection 从保管箱中选择选项