SOURCE TYPE: PHOTO ALBUM
UIImagePickerController *picker = [[UIImagePickerController alloc] init]; picker.sourceType = ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]) ? UIImagePickerControllerSourceTypePhotoLibrary : UIImagePickerControllerSourceTypeCamera; picker.delegate = self; picker.allowsEditing = YES; [self presentViewController:picker animated:YES completion:nil];
SOURCE TYPE: CAMERA
NSLog(@"photo button has been clicked"); photoButtonClicked = true; UIImagePickerControllerSourceType type = UIImagePickerControllerSourceTypeCamera; if([UIImagePickerController isSourceTypeAvailable:type]){ UIImagePickerController *picker = [self photoPicker]; //picker.allowsEditing = NO; //picker.delegate = self; //picker.sourceType = type; [self presentViewController:picker animated:YES completion:nil]; }
The code above allows you to load or present the iOS Photo Camera, easy right? It will pop up (presentViewController) the built in camera and will automatically save the asset into your (by default) Camera Roll.
That would be all guys! Please subscribe! Cheers! If you have clarifications, post it on the comment box below the post.
Post a Comment