计算图片的全屏显示尺寸

CGSize imageSize = CGSizeMake(100, 100);
CGSize size = [UIScreen mainScreen].bounds.size;
CGFloat height = size.width * (imageSize.height / imageSize.width);
if(height > size.height) {
    height = size.height;
}
CGFloat width = height * imageSize.width / imageSize.height;
return CGSizeMake(width, height);

图片宽高比3:4

CGFloat scale = 3/4.0;
    CGFloat ow = originSize.width;
    CGFloat oh = originSize.height;
    CGFloat height = ow/scale;
    if(height > oh) {
        height = oh;
    }
    CGFloat width = height*scale;
    
    cropWidth = width;
    cropHeight = height;

你可能感兴趣的:(计算图片的全屏显示尺寸)