UIImagePickerController 总是拍摄 640x640 的图像

发布于 2024-12-28 10:13:27 字数 330 浏览 3 评论 0原文

当我在 iPhone 应用程序中呈现 UIImagePickerController 时,它总是会出现一个周围有框架的白色方块,用户可以放大和缩小图像并使其适合白色方块。无论它们在白色方块中的大小,都会返回:

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)img editingInfo:(NSDictionary *)info

并且始终为 640x640。

为什么用户不能选择整个图像?为什么这个白色方块会出现?

When I present a UIImagePickerController in my iPhone App, it always comes up with a white square with a frame around it, and the user has can zoom in and out of an image and make it fit within the white square. Whatever they fit in the white square is what is returned to:

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)img editingInfo:(NSDictionary *)info

and it is always 640x640.

Why can't the user select an entire image? Why does this white square even come up?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

仙气飘飘 2025-01-04 10:13:27

内置编辑非常有限。以下是 Apple文档 说:

编辑控件指定相机界面是否应提供
用户控制移动和缩放捕获的图片,或者
修剪捕获的影片,将 allowsEditing 属性设置为 YES(以
提供编辑控件)或NO

当使用内置编辑控件时,图像选择器控制器
强制执行某些选项。对于静止图像,选择器强制执行
方形裁剪以及最大像素尺寸。对于电影来说,
选择器强制执行最大电影长度和分辨率。如果你想
让用户编辑全尺寸媒体,或指定自定义裁剪,您
必须提供您自己的编辑 UI。

Built in editing is very limited. Here is what the Apple documentation says:

Editing controls To specify whether the camera interface should offer
the user controls for moving and scaling the captured picture, or for
trimming the captured movie, set the allowsEditing property to YES (to
provide editing controls) or to NO.

When using built-in editing controls, the image picker controller
enforces certain options. For still images, the picker enforces a
square cropping as well as a maximum pixel dimension. For movies, the
picker enforces a maximum movie length and resolution. If you want to
let the user edit full-size media, or specify custom cropping, you
must provide your own editing UI.

情归归情 2025-01-04 10:13:27

确保您没有启用 UIImagePickerController 的编辑功能。
你只需要这个:

UIImagePickerController* imagePicker = [[UIImagePickerController alloc] init];
[imagePicker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
[imagePicker setDelegate:self];
[controller presentModalViewController:imagePicker animated:YES];
[imagePicker release];

Make sure you're not enable editing for the UIImagePickerController.
You just need this:

UIImagePickerController* imagePicker = [[UIImagePickerController alloc] init];
[imagePicker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
[imagePicker setDelegate:self];
[controller presentModalViewController:imagePicker animated:YES];
[imagePicker release];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文