1. Click the button to trigger the event, call the system's album
#pragma Mark Click event
-(void) Onclickcarmerbutton
{
Uiactionsheet *sheet = [[Uiactionsheet alloc] initwithtitle:@ "Please select the source of the photo" Delegate:self cancelbuttontitle:@ "Cancel" Destructivebuttontitle:nil otherbuttontitles:@ "Select from album", @ "take photos", nil];
[Sheet ShowInView:self.view];
}
#pragma Mark Actionsheetdelegate
-(void) Actionsheet: (Uiactionsheet *) Actionsheet Clickedbuttonatindex: (Nsinteger) Buttonindex
{
Uiimagepickercontroller *IMAGEVC = [[Uiimagepickercontroller alloc] init];
Imagevc.delegate = self;
if (Buttonindex = = 0) {
Imagevc.sourcetype = uiimagepickercontrollersourcetypephotolibrary;
}else if (Buttonindex = = 1) {
Imagevc.sourcetype = Uiimagepickercontrollersourcetypecamera;
}else if (Buttonindex = = 2) {
Return
}
[Self PRESENTVIEWCONTROLLER:IMAGEVC animated:no completion:nil];
}
#pragma mark-uiimagepickercontroller Delegate
-(void) Imagepickercontroller: (Uiimagepickercontroller *) Picker Didfinishpickingmediawithinfo: (NSDictionary *) info
{
UIImage *image = Info[uiimagepickercontrolleroriginalimage];
[Self uploadimage:image];
[Self dismissviewcontrolleranimated:yes completion:nil];
}
-(void) Imagepickercontrollerdidcancel: (Uiimagepickercontroller *) picker
{
[Self dismissviewcontrolleranimated:yes completion:nil];
}
-(void) Navigationcontroller: (Uinavigationcontroller *) Navigationcontroller Willshowviewcontroller: ( Uiviewcontroller *) Viewcontroller animated: (BOOL) animated
{
Bug Fixes:uiimagepickercontroller The problem of StatusBar color in use
if ([Navigationcontroller Iskindofclass:[uiimagepickercontroller class]] &&
((Uiimagepickercontroller *) navigationcontroller). SourceType = = uiimagepickercontrollersourcetypephotolibrary) {
[[UIApplication sharedapplication] setstatusbarhidden:no];
[[UIApplication sharedapplication] setstatusbarstyle:uistatusbarstylelightcontent Animated:NO];
}
[[Uinavigationbar appearance] Settintcolor:[uicolor Blackcolor]];
[Navigationcontroller.navigationbar Settintcolor:[uicolor Whitecolor];
}
The above code is just a rough step
Iosdia Call System Album