简体   繁体   English

如何设置滑动以快速删除UITableview框架高度

[英]How to set swipe to delete UITableview frame height in swift

The Swipe delete button shows depends on TableviewCell Height. 滑动删除按钮的显示取决于TableviewCell Height。 Need to reduce the height of the delete button. 需要减小删除按钮的高度。 Can anyone help me please? 谁能帮我吗?

It is not a good practice to change native controls, but you still can do it by subclassing UITableViewCell 更改本机控件不是一个好习惯,但是您仍然可以通过对UITableViewCell进行子类化来实现

@implementation UITableViewCellSubclass

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

@end

But, it is very bad way to handle it. 但是,这是处理它的非常糟糕的方法。 Better create custom UITableViewCell with custom behaviour and custom delete UIButton and then do whatever you want with it. 更好地创建具有自定义行为的自定义UITableViewCell并自定义删除UIButton ,然后对它执行任何操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM