简体   繁体   中英

How to combine TabBarController with Navigation Controller?

I was working on an app embedded with navigation controller. Now I want to add tab bar controller to it. Which is, there are several buttons on the first page, after clicking them, they lead to different tab bar controllers(let's say, two view controllers each TabBarController).

What I did was: I dragged TabBarController from Object Library, ctrl+drag to connect an button from the first page to TabBarController. I create two UIViewControllers called System1 and System2 and set the two tab bar view controllers to them.

Then I tried to run on the simulator. When I press the button, the app was terminated:

Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key requestInfo.'

Can anyone tell me what did I do wrong and how to fix it?

Thanks in advance.

If you use a Tabbar controller, that has to be the window's root view controller, and then you can have one or more navigation controllers as the view controllers in the tabs. This is explained in Apple's View Controller Programming Guide. Its the only way to make it work.

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