UITableViewCell's imageView fit to 40x40

前端 未结 7 1788
离开以前
离开以前 2020-12-04 16:14

I use the same big images in a tableView and detailView. Need to make imageView filled in 40x40 when an imags is showed in tableView, but stretched on a half of a screen. I

7条回答
  •  时光取名叫无心
    2020-12-04 16:31

    I have mine wrapped in a UIView and use this code:

    imageView.contentMode = UIViewContentModeScaleAspectFit;
    imageView.autoresizingMask = UIViewAutoresizingFlexibleWidth |UIViewAutoresizingFlexibleHeight;
    [self addSubview:imageView];
    imageView.frame = self.bounds;
    

    (self is the wrapper UIView, with the dimensions I want - I use AsyncImageView).

提交回复
热议问题