UIImagePickerController(一)

Taking Pictures and Movies

在我們的code和system兩者相互作用中,使用image picker拍攝照片和電影時(shí),主要有3個(gè)部分。

Taking a picture or movie with an image picker controller is a three part process that proceeds as an interplay between your code and the system

  1. code初始化和present一個(gè)UIImagePickerController

You instantiate and modally present a camera interface—an instance of the UIImagePickerController class.

  1. system管理camera interface,take picture or movie or cancel the operation

The system manages the camera interface and the user’s interaction with it. In typical use, the user either takes a picture or movie, or cancels the operation

  1. system調(diào)用delegate object methods,code處理界面交互的結(jié)果

The system invokes your image picker controller delegate object’s methods, which in turn handle the results of the user’s interaction—for example, by saving a new picture to the Camera Roll album. The delegate is also responsible for dismissing the camera interface.

Creating and Configuring a Camera Interface

  • 條件測試(condition test)

    • UIRequiredDeviceCapabilities info.plist

    • isSourceTypeAvailable:

  • 實(shí)例化(instantiate)

    • UIImagePickerController *cameraUI = [[UIImagePickerController alloc] init];
  • 配置(configure)

    • sourceType

    • mediaType

    • allowsEditing

    • delegate

  • 彈出(present)

    • full-screen present
  • 處理代理方法(conform delegate method)

    • dismissModalViewControllerAnimated:

    • imagePickerController:didFinishPickingMediaWithInfo:

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

推薦閱讀更多精彩內(nèi)容