When doing project development, sometimes back to customize the navigation bar view, it is common to set the title text size color, left and right navgationitem.
When you do a custom navigation view, the navigation items can be customized in the form of a custom view.
There are two ways to customize the title of a navigation bar: one is to use a custom view, and the other is to adopt a system approach.
- How to use Custom view views
is to add a titleview in the navigation, you can use a label, and then set the label's background color transparent, font what the setting is very simple.
Uilabel *titlelabel = [[UILABEL  alloc] initwithframe: cgrectmake (0,  0 , 200, 44)]; /span>
Titlelabel. backgroundcolor = [UICOLOR  graycolor]; &NBSP ; , &NB Sp , &NB Sp
Titlelabel. font = [uifont boldsystemfontofsize:];
Titlelabel. TextColor = [uicolor Greencolor];
Titlelabel. textalignment = nstextalignmentcenter; &N Bsp , &NB Sp , &NB Sp , &NB Sp , &NB Sp  
Titlelabel. text = @ " news "; , &NB Sp , &NB Sp , &NB Sp
self . Navigationitem. Titleview = Titlelabel;
- It is also possible to modify the file size and color directly in the title displayed by default
Set the size of the caption and the color of the caption text
[Self.navigationController.navigationBar settitletextattributes:
@{nsfontattributename:[uifont systemfontofsize:20],//Set the size of the title text of the navigation bar
Nsforegroundcolorattributename:[uicolor whitecolor]}];//Set the color of the title text of the navigation bar
Customize the size and color of title text on the navigation bar