#import <UIKit/UIKit.h>@interface appdelegate:uiresponder <UIApplicationDelegate> *window; @end
#import "AppDelegate.h"#import "RootViewController.h"@interfaceappdelegate ()@end@implementationappdelegate-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (Nsdictionary *) launchoptions {Self.window=[[UIWindow alloc] initwithframe:[[uiscreen mainscreen] bounds]; //Override point for customization after application launch.Self.window.backgroundColor =[Uicolor Whitecolor]; Uinavigationcontroller*root =[[Uinavigationcontroller alloc] Initwithrootviewcontroller:[[rootviewcontroller alloc] init]; Self.window.rootViewController=Root; [Self.window makekeyandvisible]; returnYES;}@end
#import <UIKit/UIKit.h>@interface rootviewcontroller:uiviewcontroller@end
#import "RootViewController.h"@interfaceRootviewcontroller () <uiactionsheetdelegate,uiimagepickercontrollerdelegate,uinavigationcontrollerdelegate >@property (Strong, nonatomic) UIButton*btn;@end@implementationRootviewcontroller@synthesizebtn;- (void) loadview{[Super Loadview]; BTN=[UIButton Buttonwithtype:uibuttontypecustom]; Btn.frame= CGRectMake ( -, -, Max, the); Btn.backgroundcolor=[Uicolor Purplecolor]; [Btn addtarget:self Action: @selector (btnaction:) forcontrolevents:uicontroleventtouchupinside]; [Self.view addsubview:btn];}- (void) Btnaction: (UIButton *) sender{Uiactionsheet*actionsheet = [[Uiactionsheet alloc] Initwithtitle:nilDelegate: Self Cancelbuttontitle:@"Cancel"Destructivebuttontitle:nil Otherbuttontitles:@"Choose from a mobile album", nil]; [Actionsheet ShowInView:self.view];}- (void) Actionsheet: (Uiactionsheet *) Actionsheet Clickedbuttonatindex: (nsinteger) buttonindex{if(Buttonindex = =0) {Uiimagepickercontroller*imagepicker =[[Uiimagepickercontroller alloc] init]; Imagepicker.Delegate=Self ; Imagepicker.sourcetype=uiimagepickercontrollersourcetypephotolibrary; Imagepicker.modaltransitionstyle=uimodaltransitionstylecoververtical; Imagepicker.allowsediting=YES; [Self presentviewcontroller:imagepicker animated:yes completion:^{}]; }}#pragmaAMRK-Picture Selection complete--(void) Imagepickercontroller: (Uiimagepickercontroller *) Picker didfinishpickingimage: (UIImage *) image editinginfo: ( Nsdictionary *) editinginfo{[picker dismissviewcontrolleranimated:yes Completion:^{[btn setimage:image forstate:0]; }];}@end
IOS pick a picture from a mobile album