I have a UINavigationController and a UITabBar within my app.
The UINavigationController has a translucent black navigation bar as follows:
in the app delegate:
[[UINavigationBar appearance] setBarStyle:UIBarStyleBlackTranslucent];
[[UINavigationBar appearance] setAlpha:0.7];
I’m also hiding the status bar and displaying my own interpretation of the status bar in the lower, transparent half of the UINavigationBar, like this:
self.navigationController.view.frame = CGRectMake(0,-22,320,480);
This works once the app has been loaded: the lower half of the UINavigationbar is transparent and I can show my own status indicators there.
However, once I tap on any of the TabBar tabs and then return back to the original controller, 2 things happen:
The view managed by the UINavigationController is shifted down to start at the lower half of the UINavigationBar. The UINavigationBar is no longer transparent.
This breaks the layout of my UI by ~20-22 pixels.
How can I “persuade” my UI to remember it’s original layout and not reset to whatever it wants to be when different tabs are selected?
Thank you.
My best suggestion to you would be not to custom build everything, but since you seem to be going to all the work of creating a custom view, I would try the following:
If all else fails, then when you call the code to dismiss the new tabs and return to the original view, re-run all of the previous code you used to set up the view. You can make it easier on yourself and the system if you put all of the code to change the view in the “constructor” of the bars.
Then all you would have to do is
Something simple like this would solve your problem and still run efficiently. It’s up to you, but I would definitely consider moving toward the latter, especially if you run multiple steps just to get the two bars set up properly.
Hope this helps you.