gpt4 book ai didi

ios - UItableview分隔线的高度

转载 作者:行者123 更新时间:2023-11-29 02:38:48 25 4
gpt4 key购买 nike

我可以调整 UITableview 分隔线的高度吗?我在单元格中添加 UIView 用作分隔线,它很好,问题是当我滑动单元格删除它时,删除按钮就是问题,它与分隔线重叠,或者可以我调整删除按钮的高度?

separator line delete

enter image description here

最佳答案

Rashad 粘贴的代码很旧(找到 here )并且似乎不适用于 iOS 7 或 iOS 8。

这里是更新后的有效代码:

-(void)layoutSubviews {

UIView *deleteButtonView = nil;

for (UIView *subview in self.subviews) {
// find the delete view in iOS 8
if ([NSStringFromClass([subview class]) isEqualToString:@"UITableViewCellDeleteConfirmationView"]){
deleteButtonView = subview;
break;
}

// find the delete view in iOS 7
if ([NSStringFromClass([subview class]) isEqualToString:@"UITableViewCellScrollView"]) {
for (UIView *secondSubview in [subview subviews]) {
if ([NSStringFromClass([secondSubview class]) isEqualToString:@"UITableViewCellDeleteConfirmationView"]) {
deleteButtonView = secondSubview;
break;
}
}
}
}

int heightOffset = 5;
CGRect buttonFrame = deleteButtonView.frame;
buttonFrame.origin.y = heightOffset;
buttonFrame.size.height = self.frame.size.height-2*heightOffset;
deleteButtonView.frame = buttonFrame;
}

关于ios - UItableview分隔线的高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26030638/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com