跳过 UIImagePickerController 预览视图?

发布于 2024-09-08 04:31:00 字数 518 浏览 2 评论 0原文

我正在使用 UIImagePickerController 允许我的用户从资源库中选择视频。

当 UIImagePickerController 最初显示时,它会显示已录制的各种电影的缩略图。

用户选择电影后,它会显示“预览”视图,允许他们播放并可能编辑所选电影。

有没有办法避免显示此视图,而是返回在缩略图屏幕上选择的电影?

这是我正在使用的代码:

UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.mediaTypes = [NSArray arrayWithObject:(NSString *)kUTTypeMovie];
imagePicker.allowsEditing = NO;

[self presentModalViewController:imagePicker animated:YES];

I'm using UIImagePickerController to allow my user to select a video from the asset library.

When the UIImagePickerController is initially displayed, it shows thumbnails for the various movies that have been recorded.

Once the user selects a movie, it displays a "preview" view which allows them to playback and potentially edit the selected movie.

Is there any way to avoid displaying this view and instead return the movie that was selected on the thumbnail screen?

Here is the code I'm using:

UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.mediaTypes = [NSArray arrayWithObject:(NSString *)kUTTypeMovie];
imagePicker.allowsEditing = NO;

[self presentModalViewController:imagePicker animated:YES];

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

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

发布评论

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

评论(2

平生欢 2024-09-15 04:31:00

我自己还没有测试过这一点,尽管我很快就会在自己的应用程序中尝试这一点。如果您查看 UIImagePickerController 显示CameraControls< /a> 文档,它暗示了这样一个事实:如果消除相机控制,您可以拍摄任意数量的照片。

因此,理论上,如果您将showCameraControls 设置为NO,并分配自己的cameraOverlayView UIView 来让用户拍照,您可以关闭图像选择器,而不会显示预览视图。

I haven't tested this myself, though I'll be attempting this in my own application shortly. If you take a look at the UIImagePickerController showsCameraControls documentation, it alludes to the fact that if you eliminate the camera controls you can take as many photos as you want.

So theoretically if you set showsCameraControls to NO, and assign your own cameraOverlayView UIView to let the user take a photo, you can dismiss the image picker without the preview view from showing.

悟红尘 2024-09-15 04:31:00

也许这有帮助。您可以使用 @"_UIImagePickerControllerUserDidCaptureItem" 上的 NSNotificationCenter 进行监听。如果用户选择该项目,您可以关闭 imagePicker 并执行缩略图操作。

我遇到了类似的问题,要删除预览视图上的覆盖,并且可以用这种方法解决它

Perhaps that helps. You could listen with the NSNotificationCenter on @"_UIImagePickerControllerUserDidCaptureItem". If the user select the item, you could dismiss the imagePicker and do your thumbnail stuff.

I had a similar issue, to remove an overlay on the preview view and could solve it with this approach.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文