从URL加载图像,然后调整大小
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了从URL加载图像,然后调整大小相关的知识,希望对你有一定的参考价值。
Some code that will load an image from a remote URL, and then resize it.
UIImage* image = [[UIImage alloc] initWithData:imageData]; // resize image CGSize newSize = CGSizeMake(100, 100); UIGraphicsBeginImageContext( newSize );// a CGSize that has the size you want [image drawInRect:CGRectMake(0,0,newSize.width,newSize.height)]; //image is the original UIImage UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); imageHeight = image.size.height; [imageMain setImage:newImage]; [imageData release]; [image release];
以上是关于从URL加载图像,然后调整大小的主要内容,如果未能解决你的问题,请参考以下文章
如何从 Firebase 存储中获取调整大小的图片下载 URL