I am using iOS 5 UINavigationBar
's UIAppearance
protocol in order to customise all my navigation bars.
Here is my customisation function:
- (void)customizeApperance
{
[[UINavigationBar appearance] setTintColor:[UIColor clearColor]];
[[UINavigationBar appearance] setAlpha:0.7];
UIImageView *titleView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"title.png"]];
[[UINavigationBar appearance] setTitleView:titleView];
}
I have two problems:
The first is that the colour not appearing as
clearColor
but black. Any suggestions?The title view is not appearing at all. Ray Wenderlich shows how to do that by adding a:
[[rootViewController navigationItem] setTitleView: [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"miniLogo.png"]]]
inapplicationDidFinishLaunching
. But the problem with this is that the title view would only be added in the root view controller. I am using aUINavigationController
and when I tired to replace therootViewController
withnavigationController
(the name of my navigation controller in AppDelegate), I cannot see the title view at all. How can I fix that? Why isn't it working incustomizeApperance()
? Isn't the whole point of using appearance is to just create a title view once (as I did above the function) and have it global in all navigation bars? How can I achieve that?