Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

After Taking Picture cannot select Use Photo or Retake

So I'm trying to update an app for iOS 7 and I'm running into issues with my custom overlay. The overlay is an image that I'm framing the photo with (both live and using a full resolution version to frame the final result in the camera roll). The problem is that now, under iOS 7, the overlay, while transparent at the bottom, provides access to the regular "take picture" button, but for some reason will not let me tap on the "Use Photo" or "Retake" buttons that come up after the picture is snapped. Here's the code snippet calling the view controller:

- (IBAction)takePhoto:(UIButton *)sender {

UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsEditing = NO;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.showsCameraControls = YES;

// Overlay Creation
UIView* overlayView = [[UIView alloc] initWithFrame:picker.view.frame];
    overlayView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"PBOverlayView.png"]];
    [overlayView.layer setOpaque:NO];
    overlayView.opaque = NO;

picker.cameraOverlayView = overlayView;

[self presentViewController:picker animated:YES completion:NULL];

}
like image 812
PorthosJon Avatar asked Sep 26 '13 03:09

PorthosJon


2 Answers

Another approach could be to observe the notifications when the ImagePicker changes state and remove (or disable) your overlay when you move into the "Use Photo" screen.

- (void) addPhotoObservers {
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(removeCameraOverlay) name:@"_UIImagePickerControllerUserDidCaptureItem" object:nil ];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(addCameraOverlay) name:@"_UIImagePickerControllerUserDidRejectItem" object:nil ];
}

- (void) removePhotoObservers {
    [[NSNotificationCenter defaultCenter] removeObserver:self];
}

-(void)addCameraOverlay {
    if (self.cameraPicker) {
        self.cameraPicker.cameraOverlayView = self.myCameraOverlayView;
    }
}

-(void)removeCameraOverlay {
    if (self.cameraPicker) {
        self.cameraPicker.cameraOverlayView = nil;
    }
}
like image 161
joneswah Avatar answered Oct 07 '22 00:10

joneswah


You could set User Enteraction Enabled to NO on Overlay View ;) works for me

like image 28
Vahan Avatar answered Oct 06 '22 23:10

Vahan