I would like to know if there is a way where I can write a generic function that can be stored in something like a Utility class that will modify UI elements?
In other words, right now I’m changing the color of certain UI elements programmatically like so:
headerLabel.textColor = [UIColor colorWithRed:red green:green blue:blue alpha:1.0];
//Where red, green and blue are variables that are derived from another function
//that converts Hex to RGB and 'headerLabel' is a UILabel with a connected IBOutlet
This same procedure happens in every View Controller, so I was wondering if there is a way to make this a generic function?
In Java / the Android SDK, I can pass the context of the class and do the rest from there.
Thank you in advance!!
EDIT:
To re-phrase the question a little, I would like to have the headerLabel.textColor= function, and other methods like headerLabel.text = @"foo" in that generic class, not necessarily just the color function.
yes , its possible by creating a global file to store all your colors ,preferences like navbar,title etc,
create a class like gconstants , then store all your string here in h/m files
in .m file
@end
and in any controller declare the header file