开发者

compile error get navigationController from app delegate

开发者 https://www.devze.com 2023-02-23 02:29 出处:网络
In my AppDelegate didFinishLaunchingWithOptions, i initialized the UINavigationController TodoTaskTableViewController *tttvc = [[TodoTask开发者_开发问答TableViewController alloc] initInManagedObjectC

In my AppDelegate didFinishLaunchingWithOptions, i initialized the UINavigationController

TodoTaskTableViewController *tttvc = [[TodoTask开发者_开发问答TableViewController alloc] initInManagedObjectContext:self.managedObjectContext];
UINavigationController *navcon = [[UINavigationController alloc] init];

[navcon pushViewController:tttvc animated:NO];

[window addSubview:navcon.view];

[navcon release];

[window makeKeyAndVisible];

Then at my TodoTaskTableViewController i click on a button which push another modal view, and found that navigation bar of the modal view gets hidden below the AppDelegate's navigation bar.

So i try to hide the AppDelegate's navigation bar by setting it like:

AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];

[appDelegate.navigationController setNavigationBarHidden:YES animated:YES];

but i actually get a compile error : Request for member "navigationController" in something not a structure or union"

Any idea how to fix this?


You need to add a property called navigationController to your app delegate, and then set it to navcon.

In AppDelegate didFinishLaunchingWithOptions:

self.navigationController = navcon;
0

精彩评论

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

关注公众号