Set the font color and size of the navigation bar title in iOS, and the friends you need can refer to below.
In peacetime development projects, inevitably encounter changes in the navigation bar font size and color requirements, the general use of custom view methods, in fact, there is a method.
Method One: (The way to customize the view, the average person will also use this way)
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.
Customizing the title View
UILabel *titlelabel = [[UILabel
Alloc] initwithframe:CGRectMake (0,
0, (+ )];
Titlelabel. backgroundcolor = [uicolor
Graycolor];
Titlelabel. font = [uifont
Boldsystemfontofsize £ º];
Titlelabel. TextColor = [uicolor
Greencolor];
Titlelabel. textalignment =
Nstextalignmentcenter;
Titlelabel. Text =
@ " news ";
Self. Navigationitem. Titleview = Titlelabel;
Method Two: (It is also possible to modify the file size and color directly in the title displayed by default)
[Self.navigationController.navigationBar settitletextattributes:
@{nsfontattributename:[uifont Systemfontofsize:19],
Nsforegroundcolorattributename:[uicolor Redcolor]}];
Mode two is simpler and more convenient than the way one
Set the font color and size of navigation bar headings in iOS