I am just starting out with iOS app development and it’s been a great experience so far. Apple documentation is great, but there are some questions I have that are not as technical and only someone with experience might be able to answer.
I have a bunch of UIViewController which handle the “dynamic skinning” of the custom UIViews that they control. This leads to a controller with big chunks of code which seems a bit unpractical to me.
So the question is: Following the MVC pattern, should I give the responsibility of setting a UIFont, UIColor, etc to the view itself? Or should I create “micro” controllers that handle this task using some kind of input?
Thanks for the response.
Creating
UIViewsubclasses that handle the layout works. OverridelayoutSubviewsin theUIViewsubclass to do the positioning layout (setting frames etc). I find theinitmethod to be a good place to set fonts, colors etc.Now the
UIViewControllerhas relatively little code related to the custom UIView. The viewController just needs to position an instance of the custom UIView and perhaps set a few properties (like a textLabel’s text).