iphone:需要在viewbartroller中实现navigationController,它在tabbar中选择一个标签后出现

时间:2011-06-07 10:00:52

标签: iphone uinavigationcontroller uitabbarcontroller

我对UITabBarController很新。我试图在viewController中提供与tabViewController中的选项卡相对应的导航系统

在viewDidLOad

中创建了一个导航控制器实例
[testLabel setText:@"Test"];
self.navigator=[[UINavigationController alloc] initWithRootViewController:self];
[super viewDidLoad];
按下按钮

我这样做

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

但是当我点击按钮时没有任何事情发生

你能帮帮我吗? 感谢

1 个答案:

答案 0 :(得分:1)

只需在AppDelegate.h中添加

即可
UINavigationController *navigationController;

只需在AppDelegate.m

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