CLRNavigationController

Created: 2011-07-15 04:59
Updated: 2013-09-20 11:38

README.md

CLRNavigationController

CLRNavigationController and CLRNavigationBar allow you to use a background image on your UINavigationBar in a way which Apple has said they support (So hopefully it will keep working on future versions of iOS). The logic is that the UINavigationController is loaded from a nib file in which you can set the class of the UINavigationBar to your own custom subclass, in this case CLRNavigationBar.

Setup

Add as submodule:

git submodule add https://github.com/crayment/CLRNavigationController.git

Or just copy the files into your project.

Usage

If your UINavigationBar is in a xib file you can simply set the class of the nested UINavigationBar to CLRNavigationBar in Interface Builder. Then somewhere in code:

UIImage *backgroundImage = [UIImage imageNamed:@"nav_bar_background"];
[(CLRNavigationBar *)self.navigationController.navigationBar setBackgroundImage:backgroundImage];

If you create your UINavigationController in code then you can just create a CLRNavigationController instead:

UIImage *backgroundImage = [UIImage imageNamed:@"nav_bar_background"];
UINavigationController *navController = [CLRNavigationController loadFromNibAndSetBackgroundImage:backgroundImage];
Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more