IOS----------Call system cameras and albums

Source: Internet
Author: User

iOS 10 remember to add in plist to get photos and album permissions, iOS 10 Remember to add in plist to get photos and album permissions, iOS 10 Remember to add in plist to get photos and album permissions, iOS 10 Later remember to add in plist to get photos and album permissions, iOS 10 Remember to add to plist inside to get photos and album permissions, iOS 10 Remember to add to the plist inside to get photos and album permissions, iOS 10 Remember to add in plist to get photos and album permissions , iOS 10 Remember to add in plist to get photos and album permissions, iOS 10 Remember to add in plist to get photos and album permissions, iOS 10 Remember to add in plist to get photos and album permissions, iOS 10 Later remember to add in plist to get photos and album permissions, iOS 10 Remember to add to plist inside to get photos and album permissions, iOS 10 Remember to add to the plist inside to get photos and album permissions, iOS 10 Remember to add in plist to get photos and album permissions.

/**

* Call Camera

*/

-(void) Opencamera

{

uiimagepickercontroller *picker = [[uiimagepickercontroller alloc] init];

Picker. delegate = self;

Picker. allowsediting = YES; // Editable

// Determine if the camera can be opened

if ([uiimagepickercontroller issourcetypeavailable: Uiimagepickercontrollersourcetypecamera])

{

// camera

Picker. sourcetype = Uiimagepickercontrollersourcetypecamera;

[self presentviewcontroller:p icker animated:YES completion:nil ];

}

Else

{

NSLog(@ " no camera ");

}

}

/**

* Open album

*/

-(void) openphotolibrary

{

//Supported orientations have no common orientation with the application, and [Puuialbumlistviewcontroller Shouldauto Rotate] is returning YES

// Enter album

if([uiimagepickercontroller issourcetypeavailable: Uiimagepickercontrollersourcetypephotolibrary])

{

uiimagepickercontroller *imagepicker = [[uiimagepickercontroller alloc]Init ];

Imagepicker. allowsediting = YES;

Imagepicker. sourcetype = uiimagepickercontrollersourcetypephotolibrary;

Imagepicker. delegate = self;

[self presentviewcontroller: Imagepicker animated:YES completion: ^{

NSLog(@ " Open album ");

}];

}

Else

{

NSLog(@ " cannot open album ");

}

}

#pragma mark-uiimagepickercontrollerdelegate

Photo Completion callback

-(void) Imagepickercontroller: (uiimagepickercontroller *) Picker didfinishpickingimage: ( UIImage *) image editinginfo: (nullable nsdictionary<nsstring *,ID> *) Editinginfo Ns_deprecated_ios(2_0, 3_0)

{

NSLog(@ "Finish ..." );

if(picker. SourceType = = Uiimagepickercontrollersourcetypecamera)

{

// images in albums

uiimagewritetosavedphotosalbum(image, nil, nil, nil);

}

[self dismissviewcontrolleranimated:YES completion:nil];

}

go to the shooting page click the Cancel button

-(void) Imagepickercontrollerdidcancel: (uiimagepickercontroller *) Picker

{

[self dismissviewcontrolleranimated:YES completion:nil];

}

IOS----------Call system cameras and 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.