xcode - IBOutlet is nil, but it is connected in storyboard, Swift -


using swift 1.1 , xcode 6.2.

i have uistoryboard containing singular, custom uiviewcontroller subclass. on it, have @iboutlet connection of type uiview controller uiview subclass on storyboard. have similar outlets subviews of view. see figure a.

but @ run time, these properties nil (figure b). though have assured i've connected outlets in interface builder.

thoughts:

  • is possible because using subclass of subclass messes initialization? not overriding initializers
  • awakefromnib: not getting called reason
  • maybe doesn't connecting subviews on subviews

things have tried:

  • matching @iboutlet , storyboard item types (instead of uiview)
  • deleting property , outlet , re-added them

figure a

figure a*

figure b

figure b

*the obscured code in figure a is:

@iboutlet private var annotationoptionsview: uiview! @iboutlet private var arrivingleavingswitch: uisegmentedcontrol! 

thank you.

typically happens because view controller hasn't loaded view hierarchy yet. view controller loads view hierarchy when sends view message. system when time put view hierarchy on screen, happens after things prepareforsegue:sender: , viewwillappear: have returned.

since vc hasn't loaded view hierarchy yet, outlets still nil.

you force vc load view hierarchy saying self.view.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -