开发者

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

开发者 https://www.devze.com 2023-03-10 18:33 出处:网络
I am pretty new to UITabBarController. I was trying to provide a navigation system in a viewController corresponding to a tab in tabViewController

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 c开发者_如何学运维ontroller 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


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];  
}
0

精彩评论

暂无评论...
验证码 换一张
取 消