0

制作一个应用程序,我们希望将照片与一些表单数据一起发送到服务器。图片很大,上传需要很长时间,我们真的不需要网站上的像素信息。有什么方法可以调整图像的大小(来自相机或您的画廊),以便我们只将更小的图像发送到网络空间?这在 Android 中很容易做到,但我们正在努力为 iPhone 找到一个简单的解决方案。

4

3 回答 3

1

请参阅调整 UIImage大小以调整代码大小和讨论的正确方式。要选择你可以做的图像

// select image
UIImagePickerController *picker = [UIImagePickerController new];
picker.delegate = self;
picker.allowsEditing = YES;
[yourViewController presentModalViewController:picker];

// delegate method
- (void) imagePickerController:(UIImagePickerController *)picker 
 didFinishPickingMediaWithInfo:(NSDictionary *)info {
    UIImage *image = [info objectForKey:UIImagePickerControllerEditedImage];
}
于 2011-05-18T20:31:40.620 回答
0

WWDC 2010 会议 N104 涵盖了你们中的大多数问题。有一个滚动视图,但描述的方法可以在您的任务中使用。

于 2011-05-18T20:29:45.663 回答
0

在 UIImage 中:

 + (UIImage *)imageWithCGImage:(CGImageRef)imageRef scale:(CGFloat)scale orientation:(UIImageOrientation)orientation

只是想出一个主意...

UIImage smallerImage = [[ UIImage imageWithCGImage: biggerImage.CGImage scale: 0.1 orientation:  orient
于 2011-05-18T20:35:36.677 回答