I am in a situation where one of my ViewControllers has many special cases and I need an elegant way of handling them. The general idea is that the bottom half of my View is identical in each case. The top half changes for each case.
In accordance to DRY, I want to avoid make copies of my ViewController for each special case and changing the buttons at the bottom for every ViewController if I need to make a change. Usually, I create a .xib, build my UI in IB, and make my connections. I did this for the bottom half of the screen and it works fine.
For the top half of the screen, I created separate UIView instances separately. I hope to dynamically load those when before the ViewController appears (the docs tell me to use layoutSubviews, layoutIfNeeded, and setNeedsLayout).
The problem this design presents is that I am accustomed to making connections in IB with variables I have defined as IBOutlets. I follow the pattern of making variables properties in the header file to make them properties and using "synthesize" in the .m file. I'm also accustomed to the setting the delegate of UITextFields to the File's Owner so I can resign their first responder status on the keyboard.
If Interface Builder only allows me to access the File's Owner and IBOutlets in my given view, how do I access these properties in the superview that dynamically adds it? What is the proper design here?
Thanks in advance!