Can you use UIAppearance to set the titleview of UINavigationItem?
Asked Answered
C

1

10

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.

Cinematography answered 27/6, 2012 at 16:30 Comment(2)
Simply, No. If you're looking into the Header files, properties must be marked with UI_APPEARANCE_SELECTOR. UINavigationItem does also not comply to the UIAppearance protocol.Eskilstuna
ah,that's what I figured, thanks.Cinematography
P
1

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.

Pauperism answered 20/4, 2013 at 9:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.