我从一个网址返回一张图片
NSData *imageData = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:Result]];
我把它存储到谷歌地图标记我想把它调整到一半大小
最佳答案
试试下面的代码:
UIImage *actualImage = [UIImage imageWithData:imageData];
UIGraphicsBeginImageContext(CGSizeMake(actualImage.size.width/2, actualImage.size.height/2);
[actualImage drawInRect:CGRectMake(0,0,actualImage.size.width/2, actualImage.size.height/2)];
UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
NSData *smallData = UIImagePNGRepresentation(newImage);
关于ios - 从 url objective-c 调整图像大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23909055/