在iphone中调整图像大小和填充屏幕?
我异步获取图像,并在小帧(135126)和大帧(280325)上显示它们,图像可以是任何大小,但帧是固定的,必须填充帧,现在我的问题是,如何调整图像大小以填充这些大小的帧,但质量不应降低,而且图像的方向也不应降低,例如UIViewContentModeScaleAspectFill属性如何在iphone中调整图像大小和填充屏幕?,iphone,Iphone,我异步获取图像,并在小帧(135126)和大帧(280325)上显示它们,图像可以是任何大小,但帧是固定的,必须填充帧,现在我的问题是,如何调整图像大小以填充这些大小的帧,但质量不应降低,而且图像的方向也不应降低,例如UIViewContentModeScaleAspectFill属性如何 UIImage *image = [actualImage you want to resize]; UIImage *tempImage = nil; CGS
UIImage *image = [actualImage you want to resize];
UIImage *tempImage = nil;
CGSize targetSize = CGSizeMake(196,110);
UIGraphicsBeginImageContext(targetSize);
CGRect thumbnailRect = CGRectMake(0, 0, 0, 0);
thumbnailRect.origin = CGPointMake(0.0,0.0);
thumbnailRect.size.width = targetSize.width;
thumbnailRect.size.height = targetSize.height;
[image drawInRect:thumbnailRect];
tempImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
You can use this tempImage , it will be resized Image
希望有帮助