码迷,mamicode.com
首页 > 其他好文 > 详细

Chapter 10 UIImagePickerController

时间:2014-09-22 12:10:42      阅读:221      评论:0      收藏:0      [点我收藏+]

标签:io   os   ar   for   sp   on   c   ad   ef   

Chapter 10 UIImagePickerController

 

1. Setting the image picker’s sourceType:

The sourceType constant that tells the image picker where to get images. It has three possible values:

UIImagePickerControllerSourceTYpeCamera

The user will take a new picture. This source type will not work on a device that does not have a camera. So, before using this type, you have to check for a camera by sending the message isSourceTypeAvailable: to the UIImagePickerController class.

UIImagePickerControllerSourceTypePhotoLibrary

The user will be prompted to select an album and then a photo from that album.

UIImagePickerControllerSourceTypeSavedPhotosAlbum

The user picks from the most recently taken photos.

 

2. To present a view controller modally, you send presentViewController:animated:completion: to the UIViewController whose view is on the screen.

 

3. Adding the ability to record video or choose a video from the disk is as simple as adding the constant string kUTTypeMovie to the mediaTypes array. However, not all devices support video through the UIImagePickerController. Just like the class method isSourceTypeAvailable: allows you to determine if the device has a camera, the availableMediaTypesForSourceType: method checks to see if that camera can capture video. To set up an image picker controller that can record video or take still images, you would write the following code:

 

UIImagePickerController *ipc = [[UIImagePickerController alloc] init];

    NSArray *availableTypes = [UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypeCamera];

    ipc.mediaTypes = availableTypes;

    ipc.sourceType = UIImagePickerControllerSourceTypeCamera

    ipc.delegate = self;

 

Chapter 10 UIImagePickerController

标签:io   os   ar   for   sp   on   c   ad   ef   

原文地址:http://www.cnblogs.com/1oo1/p/3985533.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!