I'm trying to keep things organized and create hierarchy of views for my app. So for instance I want to create a custom view to display some text, another custom view to display progress and then use all those views in the main view created with View-Based Application template.
I know how to create it programmatically - you create UIView
subclass, implement drawRect method, place an empty UIView
in Interface Builder and chance it's Class to my custom class. My problem is that I want to create those custom view's in Interface Builder instead programmatically.
So far I've created UIViewController
controller with XIB file and in viewDidLoad
method of view controller from the template I create that custom view controller instance and add it's view as a subview of that empty UIView
added in Interface Builder (the same you would change Class in programmatic approach).
It works, but it's more of a hack for me and it's hard for me to believe that there isn't a better method where I could add those custom views in interface builder without having to implement viewDidLoad
method and create controllers and add their views inside of that method.