Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 02-08-2012, 02:52 AM   #1 (permalink)
Registered Member
 
Join Date: Nov 2010
Posts: 82
baramedia is on a distinguished road
Default Add UIButton on UIImagePicker

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....
baramedia is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 387
12 members and 375 guests
7twenty7, chiataytuday, fiftysixty, gmarro, iOS.Lover, KennyChong, kilobytedump, Leslie80, Matrix23, ryantcb, stanny, xerohuang
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,669
Threads: 94,121
Posts: 402,903
Top Poster: BrianSlick (7,990)
Welcome to our newest member, dedeys78
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 04:21 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0