I'm currently working on my very first iOS app and have been fiddling around with the following problem quite a while now:
I'm using a navigation controller with a navigation and a toolbar, which are both initially hidden. By tapping on the screen you can toggle the bars.
Now I need the bars to only be outlined by the shadowed line and otherwise be white in the background (just like the background of my root view) with black font. I accomplished that by setting
self.navigationController.toolbar.tintColor = [UIColor whiteColor];
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
and tweaking on the appearance of the font in the appdelegate a little:
[[UINavigationBar appearance] setTitleTextAttributes:
[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor colorWithRed:0 green:0 blue:0 alpha:1.0],UITextAttributeTextColor,
[UIColor colorWithRed:255 green:255 blue:255 alpha:0],UITextAttributeTextShadowColor,
[NSValue valueWithUIOffset:UIOffsetMake(0, -1)],UITextAttributeTextShadowOffset,
[UIFont fontWithName:@"Helvetica" size:0.0],UITextAttributeFont,
nil]]
All is working fine so far. Here comes the problem though:
I want both navigation and toolbar to be animated when toggled (this smooth sliding in/out) without resizing the root view. This is working for the toolbar just as it is set up now, but the navigation bar is constantly refusing to do so.
I tried setting the navigation bar to translucent:
- the root view is not resized, but the navigation bar is not animated either, it just pops up
Not setting it to translucent:
- the navigation bar is sliding in but the root view is pushed down
I also tried to set the autoresizingMask of the navigation bar to UIViewAutoresizingNone and tried to set the springs and struts of my view in the interface builder, but nothing helped.
Thanks in advance for any help.
You could try using the setCenter:
and setFrame:
methods on the UINavigationBar
to perform your 'slide'.