I'm trying to add a button to a UIImageView with a transparent background - the button is shown ok but is not responding. (takePictureClicked is not called)
My code:
cameraController = [[UIImagePickerController alloc] init];
cameraController.sourceType = UIImagePickerControllerSourceTypeCamera;
cameraController.delegate = self;
cameraController.allowsEditing=YES;
cameraController.showsCameraControls = NO;
cameraController.navigationBarHidden = YES;
cameraController.toolbarHidden = YES;
// overlay on top of camera lens view
UIImageView *cameraOverlayView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"camera_overlay.png"]];
cameraOverlayView.alpha = 0.0f;
//Take picture button
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
UIImage *btnImage = [UIImage imageNamed:@"714-camera.png"];
[button setImage:btnImage forState:UIControlStateNormal];
[button addTarget:self action:@selector(takePictureClicked) forControlEvents:UIControlEventTouchUpInside];
button.frame = CGRectMake(cameraOverlayView.center.x-16,cameraOverlayView.frame.size.height,32,32);
[cameraOverlayView addSubview:button];
[cameraOverlayView setUserInteractionEnabled:YES];
[cameraOverlayView bringSubviewToFront:button];
cameraController.cameraOverlayView = cameraOverlayView;