0

In my application currently I have implemented custom view in place of UINavigationBar. But there are 14-15 screens. So I repeatedly created that top view fro each screen.

So while surfing for the solution to avoid this repetition. I came across the concept of UIAppearance. But I don't know how to implement it. I have also gone through some basic concept of it but still I am very confuse.

My top view is bit different for each screen. Like in 4-5 screens there is Two buttons(back button on left and call button right) with one label in center.

Then in other 4-5 screens there is two buttons(cancel button on left and call button on right) with one label in center.

Then in other 2-3 screens there are two buttons(side menu button on left and call button on right) with one label and icon in center.

Can anyone tell me how to achieve it using UIAppearance? Thanks in advance!

iGatiTech
  • 2,306
  • 1
  • 21
  • 45
  • Could you show some code what you've tried already? – Jasper May 12 '15 at 11:26
  • So what you want to change using UIAppearence? – Jamal Zafar May 12 '15 at 11:27
  • From what I understood, he wants to setup his UIButton's in his UINavigationBar with UIAppearance, which is not possible. – Jasper May 12 '15 at 11:29
  • Alright. Got your point. So using UIAppearance I can only set Bar's background colour. Then title's font style,it's colour etc... I can not add buttons using UIAppearance. Am I understand correctly? – iGatiTech May 12 '15 at 12:07

1 Answers1

1

You can't set buttons via UIAppearance. If you are setting titleTextAttributes on each page (for say, font, size and color), you can do that via the UINavigationBar appearance like this:

[[UINavigationBar appearance] setTitleTextAttributes:attributes];

The attributes pointer is a NSDictionary containing your textAttributes (NSFontAttributeName, NSForegroundColorAttributeName etc.)

Erik Terwan
  • 2,710
  • 19
  • 28