Resize UIImageView in UITableViewCell

后端 未结 4 1217
暖寄归人
暖寄归人 2020-12-16 03:51

I have a 16x16 pixel image that I want to display in an UIImageView. So far, no problem, however 16x16 is a bit small so I want to resize the image view to 32x32 and thus al

4条回答
  •  再見小時候
    2020-12-16 04:18

    I have successfully made it using CGAffineTransformMakeScale!

    cell.imageView.image = cellImage;
    //self.rowWidth is the desired Width
    //self.rowHeight is the desired height
    CGFloat widthScale = self.rowWidth / cellImage.size.width;
    CGFloat heightScale = self.rowHeight / cellImage.size.height;
    //this line will do it!
    cell.imageView.transform = CGAffineTransformMakeScale(widthScale, heightScale);
    

提交回复
热议问题