I have several UILabels which have same visual treatment. Instead of redefining every single property every time, I am thinking of just making copies of an instance and changing the text. Is this how it should be done?
Another way is to create a factory method, but I’m not that fond of the idea.
If you’re willing to learn Three20, you could use the
TTLabelclass, which is incorporated with Three20’s stylesheet system, which is basically designed to solve your problem. However, I personally have had trouble parsing Three20’s so-called documentation, so I think learning to use this library just to solve your problem is a lot of overhead.My work-around for this problem is to put together a mini factory method, like this:
Then when I use this method, other code gets cleaner:
PengOne suggests subclassing UILabel. That’s an option, although I think this factory method does the job just as well with less work.