Using Swift 1.1 and Xcode 6.2.
I have a UIStoryboard containing a singular, custom UIViewController
subclass. On it, I have an @IBOutlet
connection of type UIView
from that controller to a UIView
subclass on the storyboard. I also have similar outlets for subviews of that view. See figure A.
But at run time, these properties are nil (Figure B). Even though I have assured I've connected the outlets in Interface Builder.
Thoughts:
- Is it possible that because I am using a subclass of a subclass something messes up with the initialization? I am not overriding any initializers
awakeFromNib:
is not getting called for some reason
- Maybe it doesn't connecting to subviews on subviews
Things I have tried:
- Matching
@IBOutlet
and storyboard item types exactly (instead of UIView
)
- Deleting property and outlet and re-added them
Figure A*
Figure B
*The obscured code in Figure A
is:
@IBOutlet private var annotationOptionsView: UIView!
@IBOutlet private var arrivingLeavingSwitch: UISegmentedControl!
Thank you.
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…