gpt4 book ai didi

ios - 2 个单元之间的边距

转载 作者:行者123 更新时间:2023-11-29 05:52:12 27 4
gpt4 key购买 nike

您好,我正在尝试为我的所有 PackageCell 添加顶部和底部边距。像Cells need space between eachother

我尝试了什么

  %hook PackageCell
-(void)didMoveToWindow {

self.layer.cornerRadius = 15.0f;
self.layer.masksToBounds = true;
%orig;
}
-(CGRect)frame {
CGRect r = %orig;
return CGRectMake(40, 0, r.size.width, r.origin.height+20);
}
-(void)setFrame:(CGRect)frame {
CGRect r = frame;
%orig(CGRectMake(40, 0, r.size.width, r.origin.height+20));
}

%end

所有单元格都堆叠在一起,看起来很奇怪。

最佳答案

您应该将单元格的backgroundColor设置为[UIColor clear]

并更改 contentView 的框架并使该 View 变圆

self.contentView.layer.cornerRadius = 15.0f;

并为此更新框架

self.contentView.frame = CGRectMake(40, 0, self.frame.size.width, self.frame.origin.height+20);

关于ios - 2 个单元之间的边距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55564013/

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