Ankit Sachan
Ankit Sachan

Reputation: 7840

iphone: need to implement navigationController inside viewcontroller which appears after selecting a tab in tabbar

I am pretty new to UITabBarController. I was trying to provide a navigation system in a viewController corresponding to a tab in tabViewController

created an instance of navigation controller in viewDidLOad

[testLabel setText:@"Test"];
self.navigator=[[UINavigationController alloc] initWithRootViewController:self];
[super viewDidLoad];

on button click I do this

NSLog(@"I am here");
StartWordPickerVC *aStartWordPickerVC=[[StartWordPickerVC alloc] initWithNibName:@"StartWordPickerVC" bundle:nil];
[self.navigator pushViewController:aStartWordPickerVC animated:YES];
[aStartWordPickerVC release];

But when I click button nothing happens

Can you please help me out in this Thanks

Upvotes: 0

Views: 190

Answers (1)

Naveen Thunga
Naveen Thunga

Reputation: 3675

Just add this in AppDelegate.h

UINavigationController *navigationController;

Just add this in AppDelegate.m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions   
{  
    navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];  
    self.window addSubview:navigationController.view];  
    [self.window makeKeyAndVisible];  
}

Upvotes: 1

Related Questions