views:

793

answers:

1

I have a simple navigation based application for the iphone/objective-c

within various UIViewControllers that are pushed into view, I can set the text in the title bar using something like

self.title = @"blah blah blah"

Is there a way to control the font and font-size of the title in the title bar text?

thanks!

A: 

You can assign any UIView to a navcontroller's title area.

Create a UILabel and set its font and size anyway you want, then assign it to the UIViewController's navigationItem.titleView property. Make sure the UILabel's backgroundColor is set to clearColor.

This only works on the top-level nav-view. As the user drills down into the view controller hierarchy and the "back" button is shown the alternate titleView is ignored and the regular text label is shown.

Ramin
Is there any way to set the font-size etc. for the *drill-down* title bars?
The official docs say drill-down titleviews are ignored (presumably because they want the user to see the text before it shows up in the 'back' button of the next level down.) But you can always try overriding viewDidLoad and recursively scanning down the view hierarchy of the NavBar until you find the right UILabel then set the font on that.
Ramin