I understand that you are able to change the title of a Navigation item by calling the SetTitle method navigationItem like so:
[[ViewController navigationItem] setTitle:@"Hello World"];
However, i would like to do more then just change the text of the Navigation Item, I would like to change the colour and font style.
Are there any functions that allow you to change the colour of the Navigation Bar Title?
You can simply add and modify the following code in viewdidload method. Or you even can put a image on the navigation bar
if ([[UINavigationBar class]respondsToSelector:@selector(appearance)]) {
[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"image.png"] forBarMetrics:UIBarMetricsDefault];
}
[[UINavigationBar appearance] setTitleTextAttributes:@{
UITextAttributeTextColor : [UIColor whiteColor],
UITextAttributeTextShadowColor : [UIColor blackColor],
UITextAttributeTextShadowOffset : [NSValue valueWithUIOffset:UIOffsetMake(1, 0)],
UITextAttributeFont : [UIFont fontWithName:@"System" size:25.0]
}];
Hope this help
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With