2016-11-30 59 views
0

當用戶在iOS 10中拉出其短信應用程序並單擊相機圖標時,會出現一個選擇器視圖,允許用戶單擊其庫中的照片或拍攝照片從相同的角度來看。 Swift 3中有什麼可以讓第三方應用程序使用這種類型的ImagePickerController?截至目前,我只知道允許應用程序將照片庫或相機指定爲來源類型的方法。iOS 10 - 適用於照片和相機的UIImagePickerController

+3

iOS SDK不提供這樣的控件。您必須親自編寫它或找到其他人寫入的庫來複制相同的功能。 – rmaddy

回答

2

我想的iMessage的應用程序不使用的UIImagePickerController來實現該功能你所提及般。

使用Photos.framework和AVFoundation.framework可以創建您期望的UIViewController。

UIImagePickerController只是一個簡單的高級控制器,它缺少功能和較少的定製。很難製作複雜的界面。

1

我以前在其中一個應用中使用過ALCameraViewController。它允許你拍照,裁剪,並且有一個按鈕可以從圖庫中選擇圖像。只需將該窗格添加到您的項目中即可。

使用

使用該組件不能再簡單。將進口 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) 
相關問題