0
votes

Im creating an application using TabBarController and NavigationController. Tab bar controller has 3 tabs. On each tab when a button is clicked should push to a new class. How can this be done?? Im not able to do this because TabBarController is parent class.

3
Or some more details of your storyboard.rickster
First tell what is your base view its tan bar or navigation bar.vishiphone
viewController = [[ RewardieTabBarController alloc] initWithTabBarController]; navigationController = [[ UINavigationController alloc] initWithRootViewController:viewController]; [self.window addSubview:navigationController.view]; This my delegate classVishnu Gupta

3 Answers

0
votes

Implement UINavigationController in Your MainWindow xib file then assign property and drag it. then put this when u click the button wants to navigate to another page like call this code

YourPage *js=[[YourPage alloc] initWithNibName:@"YourPage" bundle:nil]; 
[self.navigationController pushViewController:js animated:YES];
[js release];
0
votes

I assume you are trying to push to a UIViewController. Connect your TabBarController to a UINavigationController, then connect the desired UIViewController as the root view of the UINavigationController, your button should now be able to push to the UIViewController(the root view controller) via the UINavigationController.

Hope this helps.

0
votes

Finally I tried to push my class with the delegate objects and it's worked.Here is the code.

loginViewController = [[ LoginViewController alloc] init];
    RewardieAppDelegate *appDelegate =  [[UIApplication sharedApplication] delegate];
    [appDelegate.navigationController pushViewController:loginViewController animated:YES];