Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I present a custom camera view controller, onto which I add a "SourceTypeCamera" UIImagePickerController as a contained child view controller. My custom view controller has a button that in turn adds another UIImagePickerController instance, this one a "SourceTypePhotoLibrary".</p> <p>You end up with a nested view controller hierarchy:</p> <ul> <li>root/main view controller <em>— presents:</em></li> <li>my custom camera view controller <em>– adds as child view controller:</em></li> <li><em>either</em> camera <em>or</em> photo-library UIImagePickerController</li> </ul> <p>Something like this:</p> <pre><code>- (void)viewDidLoad { (id&lt;UIImagePickerControllerDelegate,UINavigationControllerDelegate&gt;)theDelegate { [super viewDidLoad]; [self startImagePickerWithSourceType:UIImagePickerControllerSourceTypeCamera delegate:self]; // configure button in camera overlay to call -pickPhotoTapped } - (void) pickPhotoTapped { [self startImagePickerWithSourceType:UIImagePickerControllerSourceTypePhotoLibrary delegate:self]; } - (BOOL) startImagePickerWithSourceType:(UIImagePickerControllerSourceType)sourceType delegate:(id&lt;UIImagePickerControllerDelegate,UINavigationControllerDelegate&gt;)theDelegate { if (([UIImagePickerController isSourceTypeAvailable:sourceType] == NO) || (theDelegate == nil)) return NO; self.cameraUI = [[UIImagePickerController alloc] init]; self.cameraUI.sourceType = sourceType; self.cameraUI.view.frame = self.view.bounds; self.cameraUI.delegate = theDelegate; if (sourceType == UIImagePickerControllerSourceTypeCamera) { self.cameraUI.allowsEditing = NO; self.cameraUI.showsCameraControls = NO; self.cameraUI.cameraOverlayView = [self overlayView]; } [self addChildViewController:self.cameraUI]; [self.view addSubview:self.cameraUI.view]; [self.cameraUI didMoveToParentViewController:self]; return YES; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload