ios - Nil Enherited outlet on the subclass -
i've defined base class outlet , attached outlet view in nib file
class basecontroller: uiviewcontroller { @iboutlet weak var myview : uiview! , created subclass class subviewcontroller: basecontroller { override func viewdidload() { myview.backgroundcolor = uicolor.red //the app crashes here
when call basecontroller()
view appears, when call subviewcontroller()
app crashes because myview
nil. files owner on nib file basecontroller.
try create custom initializer in subclass:
init() { super.init(nibname: "basecontroller", bundle: nil) }
Comments
Post a Comment