当用户在iOS 10中提取他们的短信应用并点击相机图标时,会出现一个选择器视图,允许用户点击其库中的照片或从同一视图中拍摄照片。 Swift 3中有什么东西允许第三方应用程序使用这种类型的ImagePickerController吗?截至目前,我只知道允许应用程序将照片库或相机专门指定为源类型的方法。
答案 0 :(得分:2)
我认为iMessage的应用程序不使用UIImagePickerController来实现您提到的功能。
使用Photos.framework和AVFoundation.framework可以创建您期望的UIViewController。
UIImagePickerController只是一个简单的高级控制器,缺乏功能和较少的自定义。用它制作复杂的接口很难。
答案 1 :(得分:1)
之前我在其中一个应用中使用了ALCameraViewController。它允许您拍摄照片,裁剪,并有一个按钮从库中选择图像。只需将pod添加到您的项目中即可。
<强>用法强>
使用此组件并不简单。添加导入 ALCameraViewController到控制器文件的顶部。
在viewController中
let croppingEnabled = true let cameraViewController = CameraViewController(croppingEnabled: croppingEnabled) { [weak self] image, asset in // Do something with your image here. // If cropping is enabled this image will be the cropped version self?.dismiss(animated: true, completion: nil) } present(cameraViewController, animated: true, completion: nil)