iOS从远程地址获取图片并修改尺寸

iOS从远程地址获取图片并修改尺寸,第1张

概述iOS从远程地址获取图片并修改尺寸

下面是内存溢出 jb51.cc 通过网络收集整理的代码片段。

内存溢出小编现在分享给大家,也给大家做个参考。

Nsstring* imageURL = [Nsstring stringWithFormat: @"http://theimageurl.com/?ID=%@",[[resultsEntrIEs objectAtIndex:0] objectForKey: @"image_large"]];NSData* imageData = [[NSData alloc]initWithContentsOfURL:[NSURL URLWithString:imageURL]];   UIImage* image = [[UIImage alloc] initWithData:imageData];// resize imageCGSize newSize = CGSizeMake(100,100);UIGraphicsBeginImageContext( newSize );// a CGSize that has the size you want[image drawInRect:CGRectMake(0,newSize.wIDth,newSize.height)];//image is the original UIImageUIImage* newImage = UIGraphicsGetimageFromCurrentimageContext();UIGraphicsEndImageContext();        imageHeight = image.size.height;[imageMain setimage:newImage];[imageData release];[image release];

以上是内存溢出(jb51.cc)为你收集整理的全部代码内容,希望文章能够帮你解决所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

总结

以上是内存溢出为你收集整理的iOS从远程地址获取图片并修改尺寸全部内容,希望文章能够帮你解决iOS从远程地址获取图片并修改尺寸所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1107784.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-29
下一篇2022-05-29

发表评论

登录后才能评论

评论列表(0条)

    保存