Does anyone know how can I use my custom subclass of UINavigationBar if I instantiate UINavigationController programmatically (without IB)?
As of iOS 4, you can use the UINib class to help solve this issue.
UINavigationBar subclass.UINavigationController as the single
object. UINavigationController's UINavigationBar to your custom subclass.[navController setViewcontrollers[NSArray arrayWithObject:myRootVC]]; [navController pushViewController:myRootVC];In code:
UINib *nib = [UINib nibWithNibName:@"YourCustomXib" bundle:nil];
UINavigationController *navController =
[[nib instantiateWithOwner:nil options:nil] objectAtIndex:0];
Now you've got a UINavigationController with your custom UINavigationBar.