I have a toolbar at the top and at the bottom both set in the window. I am also using a UINavigationController. So I want to hide the nav bar as well. I found this question:
Persistent UIBarButtonItem in UIToolbar?
So in the app delegate I did:
[window addSubview:navigationController.view];
CGRect frame = navigationController.view.frame; // What is this view???
frame.size.height -= (topToolBar.frame.size.height + bottomToolBar.frame.size.height + [UIApplication sharedApplication].statusBarFrame.size.height);
frame.origin.y += topToolBar.frame.size.height + [UIApplication sharedApplication].statusBarFrame.size.height;
navigationController.view.frame = frame;
[navigationController setNavigationBarHidden:YES];
The toolbars are linked in IB. This is what you can see:
- The status bar. OK.
- Half the top toolbar
- The nav bar which obscures the bottom half of the top toolbar and a bit of the loaded view.
- Your first view with a small portion at the top hidden by the nav bar.
- The bottom toolbar is OK.
setNavigationBarHidden just seems to move the nav bar out of the way. I can achieve what I want by explicitly setting hidden=YES on the nav bar (or a category on UINavigationBar and overriding drawRect).
The view on the nav controller is apparently a UILayoutContainerView. This appears to be undocumented.
So:
- Is this a good method? May it get rejected?
- Why do I get this overlapping behaviour with the nav bar?