gpt4 book ai didi

iphone - 是否可以重新定位和调整标准 UITableViewCell 的 UIImageView 的大小

转载 作者:行者123 更新时间:2023-11-28 18:41:05 24 4
gpt4 key购买 nike

现在我知道 UITableViewCell 默认有一个 imageView 但是我尝试调整它的大小和原点,但它不会这样做。我是否必须为此创建 UITableViewCell 的子类?

最佳答案

如果你想改变表格 View 单元格的默认样式,你最好继承一个,你可以通过 layoutSubviews 方法很容易地改变它的 ImageView 的框架,就像这样:

@implementation CustomTableViewCell

//...

- (void)layoutSubviews {
[super layoutSubviews];

// ...
CGRect imageViewFrame = CGRectMake(...);
[self.imageView setFrame:imageViewFrame];

// you can also modify the frame or position for textLabel, detailTextLabel, etc.
}

@end

关于iphone - 是否可以重新定位和调整标准 UITableViewCell 的 UIImageView 的大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10747797/

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