ios 向 UIImagePickerController 的工具栏添加“从照片库中选择”按钮

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8878973/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 16:20:38  来源:igfitidea点击:

Adding a "Pick from Photo Library" button to UIImagePickerController's toolbar

iosuiimagepickercontroller

提问by RickiG

I am implementing a flow where the user can either select a photo from their library or take a photo using the camera. When presenting the UIImagePickerController modally I have to either go:

我正在实施一个流程,用户可以从他们的库中选择一张照片或使用相机拍照。当以模态呈现 UIImagePickerController 时,我必须要么去:

picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;  

or

或者

picker.sourceType = UIImagePickerControllerSourceTypeCamera;

This means presenting a "scaffolding controller" where to user can pick either their Library or the Camera. I see that most other apps with this kind of functionality go directly to the Camera controller, but displays a button for selecting from the library instead.

这意味着呈现一个“脚手架控制器”,用户可以在其中选择他们的图书馆或相机。我看到大多数其他具有这种功能的应用程序直接进入相机控制器,但会显示一个用于从库中进行选择的按钮。

All examples/tutorials I can find, including Apple's PhotoPicker source, does this empty viewController where you pick from camera or library - but all apps I check does the 'direct to camera - with the option for going to library".

我能找到的所有示例/教程,包括 Apple 的 PhotoPicker 源代码,都会在您从相机或库中选择的空视图控制器中执行此操作 - 但我检查的所有应用程序都执行“直接到相机 - 并带有转到库的选项”。

How do I add the photo library button option to the camera tool bar?

如何将照片库按钮选项添加到相机工具栏?

(app >= iOS 4.3)

(应用程序 >= iOS 4.3)

Thanks for any help given.

感谢您提供的任何帮助。

采纳答案by Vik

According to this previous question

根据这个先前的问题

Enabling the photo library button on the UIImagePickerController

启用 UIImagePickerController 上的照片库按钮

you can use cameraOverlayView and showsCameraControls to make the implementation.

您可以使用 cameraOverlayView 和 showsCameraControls 来实现。

-Vik

-维克

回答by Igor

For this purpose I have used PhotoPickerby Apple.

为此,我使用了 Apple 的PhotoPicker