Hi !
I develop an augmented reality application and I want to add a uibutton on uiimagepicker as a subview. The problem is that the button does not respond on my taps. Does anyone know how I can make the button to respond?
This is my code:
Code:
-(IBAction)Camera{
UIImagePickerController *imgPicker = [[UIImagePickerController alloc]init];
imgPicker.allowsEditing = NO;
imgPicker.delegate = self;
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]){
imgPicker.sourceType = UIImagePickerControllerSourceTypeCamera;
[NSThread detachNewThreadSelector:@selector(AnimationThread) toTarget:self withObject:nil];
imgPicker.showsCameraControls = NO;
imgPicker.navigationBarHidden = NO;
imgPicker.wantsFullScreenLayout = YES;
CGAffineTransform translate = CGAffineTransformMakeTranslation(0.0, 27.0);
imgPicker.cameraViewTransform = translate;
CGAffineTransform scale = CGAffineTransformScale(translate, 1.125, 1.125);
imgPicker.cameraViewTransform = scale;
UIButton *ShotButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[ShotButton addTarget:self action:@selector(Shot) forControlEvents:UIControlEventTouchUpInside];
ShotButton.frame = CGRectMake(284.0, 442.0, 72.0,37.0);
ShotButton.center = CGPointMake(284.0, 442.0);
imgPicker.cameraOverlayView.userInteractionEnabled = YES;
[imgPicker.cameraOverlayView addSubview:ShotButton];
[imgPicker.cameraOverlayView bringSubviewToFront:ShotButton];
[self presentModalViewController:imgPicker animated:YES];
}
[imgPicker release];
-(void)Shot{
NSURL* musicFile = [NSURL fileURLWithPath:[[NSBundle mainBundle]
pathForResource:@"Shot"
ofType:@"wav"]];
click = [[AVAudioPlayer alloc] initWithContentsOfURL:musicFile error:nil];
[click play];
}
Thank you very much....