I'd like to create a basic view controller class BasicController with two subclasses SubclassController and AnotherSUbClassController. BasicController controls view that have a button inside them, so there should be a
weak var buttonThing: UIButton?
property in it. In the actual implementation I want to use the subclasses in various parts of the interface: I want to draw them in storyboard, put buttons in that drawings, and connect the buttons to the inherited buttonThing property via an outlet. But wait, the buttonThing property was announced in the superclass and doesn't even appear in the code of the subclasses. So how do I connect the buttons to that outlet?
You can
ctrl-drag
theUIButton
from your storyboard to yourBasicController
for each subclass you have laid out in your storyboard. You can then use thebuttonThing
in each subclass as usual.Remember to link your subviewcontrollers to their respective viewcontrollers in the storyboard.