I am trying to add an overlay to camera. To do that, I've created the following event method:
- (IBAction)takePhoto:(id)sender {
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]){
[imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera];
imagePicker.showsCameraControls = NO;
imagePicker.navigationBarHidden = YES;
imagePicker.toolbarHidden = YES;
imagePicker.wantsFullScreenLayout = YES;
// Overlay
// Insert the overlay
self.overlay = [[OverlayViewController alloc] initWithNibName:@"OverlayView" bundle:nil];
//[self.overlay.view setTranslatesAutoresizingMaskIntoConstraints:NO];
self.overlay.pickerReference = imagePicker;
imagePicker.cameraOverlayView = self.overlay.view;
imagePicker.delegate = self.overlay;
[self presentViewController:imagePicker animated:NO completion:nil];
} else{
[imagePicker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
[imagePicker setDelegate:self];
[self presentViewController:imagePicker animated:YES completion:nil];
}
}
The button is centered in a view like this.
But when used, it appears like this on iPhone 4. It is not centered vertically. If I try it to pin button Slikaj on the bottom, it is not visible because iPhone 4 screen size is smaller than iPhone 5. The use auto layout checkbox is checked (turned on). What am I doing wrong?