#import "ViewController.h"@interfaceViewcontroller () <UINavigationControllerDelegate,UIImagePickerControllerDelegate>@property (nonatomic,strong) Uiimageview*Headimageview;@end@implementationViewcontroller- (void) viewdidload {[Super viewdidload]; Self.headimageview= [[Uiimageview alloc]initwithframe:cgrectmake ( -, -, -, -)]; _headimageview.backgroundcolor=[Uicolor Yellowcolor]; _headimageview.layer.cornerradius= -; _headimageview.layer.maskstobounds=YES; _headimageview.tag=101; [Self.view Addsubview:_headimageview]; _headimageview.userinteractionenabled=YES; UITapGestureRecognizer*tap =[[UITapGestureRecognizer alloc]initwithtarget:self Action: @selector (tapaction:)]; [_headimageview Addgesturerecognizer:tap]; //additional setup after loading the view, typically from a nib.}- (void) Tapaction: (uiimageview*) sender{Uiimagepickercontroller*imagepicker =[[Uiimagepickercontroller alloc]init]; Imagepicker.allowsediting=YES; Imagepicker.sourcetype=uiimagepickercontrollersourcetypephotolibrary; Imagepicker.Delegate=Self ; [Self presentviewcontroller:imagepicker animated:yes completion:^{NSLog (@"Open Album"); }];}- (void) Imagepickercontrollerdidcancel: (Uiimagepickercontroller *) picker{[picker dismissviewcontrolleranimated:yes Completion:^{NSLog (@"Cancel"); }];}- (void) Imagepickercontroller: (Uiimagepickercontroller *) Picker Didfinishpickingmediawithinfo: (NSDictionary *) info{_headimageview.image=Info[uiimagepickercontrollereditedimage]; NSLog (@"%@", info); [Picker Dismissviewcontrolleranimated:yes Completion:^{NSLog (@"Select Photo"); }]; }- (void) didreceivememorywarning {[Super didreceivememorywarning]; //Dispose of any resources the can be recreated.}@end
Call System albums in iOS and photos using System albums