【问题标题】:UIImagePickerController always pics 640x640 imageUIImagePickerController 总是 pics 640x640 图像
【发布时间】:2012-02-16 11:55:18
【问题描述】:
当我在我的 iPhone 应用程序中展示 UIImagePickerController 时,它总是会出现一个带有框架的白色正方形,并且用户可以放大和缩小图像并使其适合白色正方形。他们在白色方块中的任何内容都是返回的内容:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)img editingInfo:(NSDictionary *)info
它始终是 640x640。
为什么用户不能选择整个图像?为什么会出现这个白色方块?
【问题讨论】:
标签:
ios
uiviewcontroller
uiimage
uiimagepickercontroller
【解决方案1】:
内置编辑功能非常有限。这是Apple documentation 所说的:
编辑控件指定相机界面是否应提供
用户控制移动和缩放捕获的图片,或
修剪捕获的电影,将allowsEditing 属性设置为YES(到
提供编辑控件)或NO。
使用内置编辑控件时,图像选择器控制器
强制执行某些选项。对于静止图像,选择器强制执行
方形裁剪以及最大像素尺寸。对于电影,
选择器强制执行最大电影长度和分辨率。如果你想
让用户编辑全尺寸媒体,或指定自定义裁剪,您
必须提供您自己的编辑 UI。
【解决方案2】:
确保您没有为 UIImagePickerController 启用编辑功能。
你只需要这个:
UIImagePickerController* imagePicker = [[UIImagePickerController alloc] init];
[imagePicker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
[imagePicker setDelegate:self];
[controller presentModalViewController:imagePicker animated:YES];
[imagePicker release];