开发者

Adding a UINavigationController built with IB

Building an iPhone application. The delegate loads a SplashScreenView which sits there until the user taps the screen. When the user is done tapping the screen, I release that view and I want to load my custom Navigation Controller. I can't figure out how to load the Navigation Controller I designed in IB...it's currently loading a blank instance of UINavigationController.

I'm running this from my delegate:

mnc = [[MyNavigationController alloc] initWithNibName:@"MyNavigation" bundle:nil];
[self.window addSubview:mnc.view];

MyNavigation is a XIB I created which only has File's Owner/First Responder/a Navigation Controller I added. I set the class of File's Own开发者_开发问答er to MyNavigationController but I'm not sure how to tell it that I want the view "MyNavigationController" uses to be the one I designed. When I try to drag the "view" outlet of File's Owner in IB to my designed Navigation Controller, it doesn't seem to like it.

I'm just not sure how to connect the dots here. Any help would be incredibly appreciated.


What is the root controller of your navigation controller? The "blank" thing that you see is probably your navigation controller loaded with no controllers for it to navigate.

Update

You don't need "two controllers" per se. It's just that navigation controller is the one that controls the stack of other controllers you provide it with. First you init your navigation controller with root view controller (with initWithRootViewController method you mentioned), then you can push (pushViewController:animated:) or pop (popViewController:animated:) other controllers to or off of the stack of navigation controller.

Apple developer documentation provides plenty information in view controller programming guide on how different types of view controllers interact.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜