跳过 UIImagePickerController 预览视图?
我正在使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我自己还没有测试过这一点,尽管我很快就会在自己的应用程序中尝试这一点。如果您查看 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.
也许这有帮助。您可以使用 @"_UIImagePickerControllerUserDidCaptureItem" 上的
NSNotificationCenter
进行监听。如果用户选择该项目,您可以关闭imagePicker
并执行缩略图操作。我遇到了类似的问题,要删除预览视图上的覆盖,并且可以用这种方法解决它。
Perhaps that helps. You could listen with the
NSNotificationCenter
on @"_UIImagePickerControllerUserDidCaptureItem". If the user select the item, you could dismiss theimagePicker
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.