views:

779

answers:

2

Hello,

I am using a UINavigationController to handle the pushing and poping of viewControllers in my app. Theres a section where i have a tab bar (not using UITabbarController) which is manageed by the same UINavigationController, i simply add the UITabBar to the navigation controllers view (by using addSubview).

The Problem: I have some UIViewControllers with table views being pushed into the navigation stack, since my Tab Bar is part of the view and not the navigation stack the TableViews are cut off at the buttom because the Navigation Controller does not know of the tab bar because its in its view and n ot the navigation stack. Without a navigation controller i would just resize the ViewControllers view and it would work fine, but when i try to do that it seems like the NavigationCOntroller just ignores my frame and sets its own and therefore the table views are cut off. I found one solution which was to add some extra cells and hide them and that works sort of OK but its kind of hackerish, anyone have any suggestion of how to go about this in a different non -hackerish way?

Thanks

A: 

Try making the root view a UIView with a UITableView for a subview. Then add the UITabBar to the UIView instance. Now the UITableView won't know about the UINavigationController.

Corey Floyd
this isnt that pretty i want my view controllers to manage my table view...I just found my answer though, I had tried this before and did not work, but now it does, check it out
Daniel
I probably didn't explain it that well. In fact you now have a UIViewController instance for the main view AND a UITableViewController instance for the table view. The UItableViewController instance is an ivar of the UIViewController instance. This also works good to split up the responsibilities of managing the table and managing the UINavigationBar, loading subviews, etc...
Corey Floyd
Coincidentally, this is similar to your current solution, with the added benefit of still using a UITableViewController to manage your table.
Corey Floyd
+1  A: 

Alright, so i solved the problem. I had tried resizing the UITableView instead of the viewController before, but this did not work. I just realized though, that this did not work because i was using a UITableViewController which manages its own tableView and was not letting me change the frame of it (maybe i was changing it in the wrong place, tried in viewDidLoad, i bet if i did it after the call to [super viewDidload] it would have worked..o well). So I changed the class to a UIViewController and managed the table view in there, now it works good, thanks for the replies.

Daniel
How about the bottom toolbar? Can you move it?
bentford