Search code examples
iosuiappearance

Should I subclass only for UIAppearance


Basically, I'm refactoring an app after reading about UIAppearance. Most of my UI changes were in the storyboard or in viewDidLoad, and customizing each control was a pain in the ass.

I have a cell, that contains two labels, let's say bigLabeland smallLabel. I'd like bigLabel to be bold, and smallLabel not to be. From this lecture, I should subclass both labels and apply the appearance on the different classes.

My question is, which practice is the best :

  • Subclass both labels
  • Just modify the attributes through the storyboard
  • Anything else ?

Thanks.


Solution

  • No. When you make UI changes in the storyboard - you're skipping the code part. That's the whole idea of using the storyboard for standard stuff, like fonts, colours and font sizes. You can do it in code, if you want to - but you don't do it with code AND storyboard. Its one or the other.