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.