Log in or register to post comments

Add UIButton for action

February 13, 2014 - 4:00am #1

I created UIButton in CROverlayViewController.mm file. But when i launch the app the button is showing in launch image and AboutViewController. After click this button i need to go AboutViewController. But it's not working.

CROverlayViewController.mm:

 

- (void)viewDidLoad

{

    [super viewDidLoad];

   about=[[AboutViewController alloc]init];

    back_btn = [UIButton buttonWithType:UIButtonTypeCustom];

    [back_btn setImage:[UIImage imageNamed:@"back.png"] forState:UIControlStateNormal];

       [back_btn setFrame:CGRectMake(10,10,40,40)];

    [back_btn addTarget:self action:@selector(back:) forControlEvents:UIControlEventTouchUpInside];

    [self.view addSubview:back_btn];

}

 

-(void)back:(id)sender{

    // [self.navigationController popViewControllerAnimated:YES];

    NSLog(@"back");

     //  [self.navigationController pushViewController:about animated:YES];

     [self dismissModalViewControllerAnimated:YES];

}

 

 

Add UIButton for action

February 13, 2014 - 4:18am #3

The log value back is coming while click the button. Does my code is correct added in CROverlayViewController.mm?

Add UIButton for action

February 13, 2014 - 4:07am #2

This is nothing to do with Vuforia, so you may not have much luck here.

Either way it is good learning and practice try to figure out for yourself why "it's not working", possibly by using the debugger though you could also search the forums...

 

N

Log in or register to post comments