I currently use this code to set the titleView of my navigation item:
- (void)viewDidLoad
{ ...
UIImage *navbarTitle = [UIImage imageNamed:@"navbartitleview1"];
UIImageView *imageView = [[UIImageView alloc]initWithImage:navbarTitle];
self.navigationItem.titleView =imageView;
}
Is there a way I could put this code using UIAppearance?
[UINavigationItem appearance]
is not valid.
Go to the ViewController. swift file and add the ViewDidAppear method. a nav helper variable which saves typing. the Navigation Bar Style is set to black and the tint color is set to yellow, this will change the bar button items to yellow.
Change the Bar Style A user changes the navigation bar's style, or UIBarStyle , by tapping the “Style” button to the left of the main page. This button opens an action sheet where users can change the background's appearance to default, black-opaque, or black- translucent.
NavController manages app navigation within a NavHost . Apps will generally obtain a controller directly from a host, or by using one of the utility methods on the Navigation class rather than create a controller directly. Navigation flows and destinations are determined by the navigation graph owned by the controller.
No you wan't be able to do that with UIAppearence
, what you can is to have a UIViewController
from where all the others UIViewController will inherit. Think way you avoid having to put that code in all your UIViewControllers
.
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