0

I want to create a navigation based application in Xcode 4.2. I have some UIButtons in .xib. On button touch event I want show another screen. I've tried Page-Based Application and Single-View Application project templates.

Here is the code I'm using to push the view controller on button touch event:

- (IBAction)btnGoToNextPageAction:(id)sender {    
    NSLog(@"btnGoToNextPageAction is pressed");

    Test2 *objTest2 = [[Test2 alloc] initWithNibName:@"Test2" bundle:nil];
    [self.navigationController pushViewController:objTest2 animated:YES];
    [objTest2 release];
}

But It only prints the NSLog text and next page doesn't appear. I took reference from these links:

I'm using .xib, not .storyboard.

Community
  • 1
  • 1
iLearner
  • 1,670
  • 2
  • 19
  • 45
  • Please check if your `navigationController` is nil or not. If nil, init it first. – Raptor Mar 19 '12 at 09:41
  • @ShivanRaptor Where shd I check it, Can u pls elabotare more on this. – iLearner Mar 19 '12 at 09:45
  • 2
    @Bhurudada something like this NSLog(@"navigationController is %@",self.navigationController); before [self.navigationController pushViewController:] – Reefaq Mar 19 '12 at 10:08
  • What is your current template for the project? Does it uses story board? –  Mar 19 '12 at 10:24
  • @Bhurudada you had created an simple view Based application but for navigationController you need to create NavigationBased Application or add Navigation by HardCode. – Aadil Mar 19 '12 at 10:25

0 Answers0