djblue2009
djblue2009

Reputation: 1372

Can you use UIAppearance to set the titleview of UINavigationItem?

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.

Upvotes: 10

Views: 1487

Answers (1)

Rui Peres
Rui Peres

Reputation: 25907

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.

Upvotes: 1

Related Questions