简体   繁体   中英

How to implement a navigation controller in a subclass?

Can anyone tell me about how to implement a navigation controller in a UIView subclass? I am creating four sub-classes, and I do not want the navigation control in first class, but I need to place it in the second, third and fourth subclass. How can I do that?

Can anybody help me? How do I implement it?

If you dnt want navigation control in first class then you can hide the navigationBar by self.navController.navigationBarHidden = YES; and this has to be in the next class self.navController.navigationBarHidden = NO;

When you call 2nd, 3rd and 4th view from 1st one (which does not have navigation bar) then call it as below:

RootViewController * rootViewController = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:rootViewController];
[self.window addSubview:navigationController.view];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM