Picking an Item from the Photo Library
UIImagePickerController的功能:
1.image picker功能主要有两个:一个是捕获picture和medias;一个是弹出一个浏览页,选择一个item
In addition to using a UIImagePickerController instance to capture new pictures and movies, you can use it to present a media browser that lets a user choose an item from their saved photo albums. The steps you take are similar to those for capturing media, as described in Taking Pictures and Movies. The differences are:
- sourceType
- take a picture or movie and save its. present a browser and display its.
Creating and Configuring a Media Browser
- 条件测试(condition test)
-
UIRequiredDeviceCapabilities info.plist
-
isSourceTypeAvailable:
-
-
实例化(instantiate)
UIImagePickerController *cameraUI [[UIImagePickerController alloc] init];
-
配置(configure)
-
sourceType
-
UIImagePickerControllerSourceTypePhotoLibrary 可以访问设备的所有相册集,包括有摄像机的设备的相机胶卷
-
UIImagePickerControllerSourceTypeSavedPhotosAlbum 限制范围:带有摄像头的设备的相机胶卷,或没有带有摄像头的设备的相册。
-
-
mediaType
check which media types are available by calling the availableMediaTypesForSourceType:,给mediaType设置一个空数组会throw an exception. -
allowsEditing
you can custom UI, for example, specify custom cropping. -
delegate
-
-
弹出(present)
-
iPhone, iPod touch full-screen present
-
iPad
-
iOS ...-9.0 UIPopoverController
-
iOS 9.0-later UIPopoverPresentationController
-
-
-
处理代理方法(conform delegate method)
- imagePickerController:didFinishPickingMediaWithInfo:
网友评论