It doesnβt matter if you are on a tab, this code goes into the ViewController class for your view
Create a collector if you want it
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
Add Collector
[self presentViewController:picker animated:YES completion:nil];
Your view controller must be declared as
@interface YourViewController :
UIViewController<UIImagePickerControllerDelegate, UINavigationControllerDelegate>
And you need to implement
- (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info;
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker;
(the first is to get the image from the information object)
In each of these messages, when this is done, remove the collector
[self dismissModalViewControllerAnimated:YES]
source
share