Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to create a cameraOverlayView
    primarykey
    data
    text
    <p>I am really struggling to get my head around how to do this. I have a <code>UIImagePickerController</code> which works fine but I want to create my own <code>CameraOverlayView</code> so that I can customise the buttons. I can't seem to figure out how to create the overlay in the first place. I have tried so many tutorials and have arrived at the following but it is way off. Can anyone point me to an simple to follow instructions?</p> <ul> <li>I have created a <code>UIImagePickerController</code> that works with standard controls</li> <li>For the overlay I have created a new <code>UIViewController</code> on my storyboard and linked it to a new class called <code>ObViewControllerCameraOverlay</code></li> <li><p>In the <code>startCameraControllerFromViewController</code> method I use the following to hide the standard controls</p> <p>cameraUI.showsCameraControls=NO;</p></li> <li><p>and then this to show the cameraOverlay (which does not compile)</p> <p>obViewControllerCameraOverlay *overlay = [[obViewControllerCameraOverlay alloc]; cameraUI.cameraOverlayView = overlay;</p></li> </ul> <p>I know I am doing this wrong but I am stumped as to how to this to work. I have looked at Apple's PhotoPicker too but I just don't get it.</p> <p>UPDATE:</p> <p>Where I am now - can anyone tell me if this is the correct process (I realise frame size needs to be sorted and custom buttons need to be added somehow):</p> <p>.m file where the 'Take Photo' <code>UIButton</code> is located. </p> <pre><code>@property (nonatomic, strong) UIView *overlay; - (IBAction)takePhoto:(id)sender { [self startCameraControllerFromViewController: self usingDelegate: self]; } - (BOOL) startCameraControllerFromViewController: (UIViewController*) controller usingDelegate: (id &lt;UIImagePickerControllerDelegate, UINavigationControllerDelegate&gt;) delegate { if (([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera] == NO) || (delegate == nil) || (controller == nil)) return NO; UIImagePickerController *cameraUI = [[UIImagePickerController alloc] init]; cameraUI.sourceType = UIImagePickerControllerSourceTypeCamera; cameraUI.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerCameraCaptureModePhoto]; cameraUI.showsCameraControls=NO; overlay = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)]; cameraUI.cameraOverlayView = overlay; cameraUI.allowsEditing = NO; cameraUI.delegate = delegate; [controller presentViewController:cameraUI animated:YES completion:nil]; return YES; } </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
 

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