开发者

ImageView vertical alignment - UITableViewCell

开发者 https://www.devze.com 2023-01-27 10:19 出处:网络
Here is my issue: I have an UITableViewCell with more than 1 line in the content (the text is very long).

Here is my issue:

I have an UITableViewCell with more than 1 line in the content (the text is very long).

The vertical alignment of the ImageView (I put an image in the left side of the cell) is in the centre (I guess this is by default), but I want to see this image in the top.

开发者_运维百科

Do you have any idea of how can I modify its vertical alignment?

Any reply will be much appreciated.

Thanks =)


I've subclasses UITableViewCell, and added this, which bumps it up to 10px below the top of the cell.

- (void)layoutSubviews {
    [super layoutSubviews];
    self.imageView.frame = (CGRect){.origin.x = (60-self.imageView.frame.size.width)/2, .origin.y = 10, .size = self.imageView.frame.size};

}
0

精彩评论

暂无评论...
验证码 换一张
取 消