I'm writing an iPad app with a UITabBarController. At the moment it has two buttons. When the user presses the first button I bring up a table view. When the use selects开发者_JS百科 a row I switch to another table view. Trouble is, when the second tabel view comes up, the tab bar is no longer visible. I feel like I need to add the second table view as a subview of the first to keep from covering the tab bar. Help!
As I'm about to sleep, I'm going to make some assumptions, post a solution that I hope helps you out :)
Firstly, I believe you've got a
UINavigationController
-> UITabBarController
-> UITableViewController
stack.
Now, what happens if you do push the new view onto the stack is that it will use the UINavigationController that exists at the top of the stack. So what you get now is
UINavigationController
-> UITableViewController2
-> UITabBarController
-> UITableViewController
which hides your TabBar, as you said. You can't use a Modal view either because that will sit on top of everything, and prevent all other views from getting interaction.
So, what you actually need is another UINavigationController within your UITabBarController, like so
UINavigationController
-> UITabBarController
-> UINavigationController
-> UITableViewController
So when you push the 2nd view, you will get this
UINavigationController
-> UITabBarController
-> UINavigationController
-> UITableViewController2
-> UITableViewController
Hope this helps you out.
精彩评论