现在我知道 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/