Suppose I have a UIColor that I want to use across every view controller to tint it’s title/navigation bar. I was wondering what is the best way to declare such a property. Should I declare it as a member of the application delegate? Create a model class for global properties, and declare a static function + (UIColor)getTitleColor? Pass the UIColor object to every view controller? Is there another method that I did not describe, that is viewed as being the best way to go about this?
Suppose I have a UIColor that I want to use across every view controller
Share
There are lots of ways to do this. I like to do it by putting a category on
UIColor:UIColor+MyAppColors.h
UIColor+MyAppColors.m
Then I can use it by importing
UIColor+MyAppColors.hin any file that needs the title bar background color, and calling it like this: