Call System albums in iOS and photos using System albums

Source: Internet
Author: User

#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

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.