iphoneiphone-sdk-3.1

Image Move & Resize not working when using a custom camera overlay iPhone SDK 3.1+


I used to use the old-school method of adding an overlay to the camera screen, and that worked fine. However, since 3.1 came out, Apple is insisting that I use the API to add an overlay. I quickly got the overlay to work, but it seems that if I use the custom overlay, then the move & resize screen is not responsive, I can only use or retake, can't actually resize & move. The code I am using is below. I have tried several variations, but the only thing that actually enables the move & resize is to remove the line that adds the custom overlay view.

Any ideas?

UIImage *image = [UIImage imageNamed:@"camera-template-long.png"];
UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)] ;
imgView.image = image;

UIView *overlayView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
overlayView.opaque = NO;
[overlayView addSubview:imgView];

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

[self presentModalViewController:picker animated:YES];

Solution

  • The entire issue goes away once you use [overlayView setUserInteractionEnabled:NO]; to stop the overlay view from handling the input.