2009-08-23 7 views
2

J'ai une barre à deux onglets, Dans le premier onglet, je peux forer plus de trois ... mais dans le deuxième onglet je ne peux pas descendre plus d'un .. Des idées?Barre d'onglets + barre de navigation

code: DemoAppdelegate.m

- (void)applicationDidFinishLaunching:(UIApplication *)application { 
[window addSubview:tabBarController.view]; 
} 

First tab controller is "FirstViewController" 
in FirstViewController.m i have written to drill down to "billsummary.xib" 


DemoAppDelegate *app = (DemoAppDelegate *)[[UIApplication sharedApplication] delegate]; 
    UINavigationController *naviController = app.navigationController; 
    BillsSummary *aViewAController = [[BillsSummary alloc] initWithNibName:@"BillsSummary" bundle:[NSBundle mainBundle]]; 

    [naviController pushViewController:aViewAController animated:YES]; 
    [aViewAController release]; 

which is working fine.But same code for in second tab for another .xib is not working and in second tab i have not used appdelegate instead i used "self.navigationcontroller" 

UINavigationController *naviController = self.navigationController; 
    PaymentsAmount *aViewAController = [[PaymentsAmount alloc] initWithNibName:@"PaymentsAmount" bundle:[NSBundle mainBundle]]; 

    [naviController pushViewController:aViewAController animated:YES]; 
    [aViewAController release]; 

quoi faire? Toute aide s'il vous plaît?

+0

Quel environnement d'exploitation êtes-vous? Est-ce jQuery, WinForms, QT? –

+0

Mac OS - Iphone -objectif c –

Répondre

0

Dans quel fichier votre deuxième extrait de code réside-t-il? Il se peut que self.navigationController ne se réfère pas au contrôleur de navigation que vous pensez faire.

3

Je ne comprenais pas la structure de votre code, mais le plus souvent ce problème est résolu de la manière suivante:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 
    ... 

    // Initialize UINavigationControllers and push first viewcontrollers for each one 

    UIViewController *view1 = [[UIViewController alloc] init]; 
    UINavigationController *nav1 = [[UINavigationController alloc] initWithRootViewController:view1]; 
    [view1 release]; 

    // Same for the second NavigationController 

    ...  

    // Initialize UITabBarController 
    UITabBarController tController = [[UITabBarController alloc] init]; 
    tController.viewControllers = [NSArray arrayWithObjects:nav1, nav2, nil]; 
    [nav1 release]; 
    [nav2 release]; 

    [window addSubview:tController.view]; 

    ... 
} 
Questions connexes