IPhone: Use uiimagepickercontroller to retrieve images from the iPhone photo library or camera

Source: Internet
Author: User

From: Use uiimagepickercontroller to retrieve images from the iPhone photo library or camera

Using uiimagepickercontroller to select a photo library is very simple:

In the corresponding response:

Uiimagepickercontroller * picker = [[uiimagepickercontroller alloc] init];

Picker. Delegate = self; // The controller must follow the response's delegate protocol of course.

Picker.Sourcetype=Uiimagepickercontrollersourcetypephotolibrary;// Specify picker resources. There are three types:

// Enum {uiimagepickercontrollersourcetypephotolibrary,

// Uiimagepickercontrollersourcetypecamera,

// Uiimagepickercontrollersourcetypesavedphotosalbum}

[SelfPresentmodalviewcontroller: PickerAnimated:Yes];// Display the picker View

 

In the delegate method:

-(Void) Imagepickercontroller :(Uiimagepickercontroller*) Picker didfinishpickingmediawithinfo :(Nsdictionary*) Info {

//Info: A dictionary containing the original image and the edited image, if an image was picked; or a filesystem URL for the movie, if a movie was picked

[PickerDismissmodalviewcontrolleranimated:Yes]; // Disappear

Imageview.Image= [InfoObjectforkey:@ "Uiimagepickercontrolleroriginalimage"];

}

 

 
Nsstring * const uiimagepickercontrollermediatype; nsstring * const region; nsstring * const uiimagepickercontrollercroprect; nsstring * const region;

Rootviewcontroller-tableview: cellforrowatindexpath-load image from assetslibrary

Using assetslibrary framework loading images too slow

 

supplement: The iPad cannot call up uiimagepickercontroller. You need to call it through popover.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.