Описание тега uiimagepickercontroller
The UIImagePickerController class manages customizable, system-supplied user interfaces for taking pictures and movies on supported devices, and for choosing saved images and movies for use in your app. An image picker controller manages user interactions and delivers the results of those interactions to a delegate object.
The role and appearance of an image picker controller depend on the source type you assign to it before you present it.
- A sourceType of
UIImagePickerControllerSourceTypeCamera
provides a user interface for taking a new picture or movie (on devices that support media capture). - A sourceType of
UIImagePickerControllerSourceTypePhotoLibrary
or
UIImagePickerControllerSourceTypeSavedPhotosAlbum provides a user
interface for choosing among saved pictures and movies.
To use an image picker controller containing its default controls, perform these steps:
- Verify that the device is capable of picking content from the
desired source. Do this calling the
isSourceTypeAvailable:
class method, providing a constant from the “UIImagePickerControllerSourceType
” enum. - Check which media types are available, for the source type you’re using, by calling the availableMediaTypesForSourceType: class method. This lets you distinguish between a camera that can be used for video recording and one that can be used only for still images.
- Tell the image picker controller to adjust the UI according to the media types you want to make available—still images, movies, or both—by setting the mediaTypes property.
- Present the user interface by calling the presentViewController:animated:completion: method of the currently active view controller, passing your configured image picker controller as the new view controller. On iPad, present the user interface using a popover. Doing so is valid only if the sourceType property of the image picker controller is set to UIImagePickerControllerSourceTypeCamera. To use a popover controller, use the methods described in “Presenting and Dismissing the Popover” in UIPopoverController Class Reference.
When the user taps a button to pick a newly-captured or saved image or movie, or cancels the operation, dismiss the image picker using your delegate object. For newly-captured media, your delegate can then save it to the Camera Roll on the device. For previously-saved media, your delegate can then use the image data according to the purpose of your app.
For details on these steps, refer to Apple's “Taking Pictures and Movies”.