I'm new to objective-c and it's a a newbie question.
I'm writing an app which has this custom looking label on many views.
(edit) The label has two parts: main label that acts as a title and a smaller sublabel that has some short text. (/edit)
It seems silly to put labels manually on all of the views so I started thinking about making a custom control that would consist of two labels: mainLabel
and subLabel
. I'm not sure what approach is better here. Should I make a custom UIView
or is there a better way of doing it?
If customizing UIView
is the right way, how should I handle setting of the labels? Is creating a protocol delegate that would make a ViewController implement label control initialization methods the right way of doing this?
EDIT: How do I reuse the custom UIView so later when the labels style changes, I don't have to change looks on each of them separatly, but to have some sort o template that's going to be used every time the custom UIView is used
I'll put the answer here for anyone who'd have the same question:
You should use a custom UIView to control setting the labels (check the answer below) together with a .xib file which will define a template for the looks of the label. If you're interested about UIView and .xib files check out this: How to use a xib and a UIView subclass together?
Thanks for your help!