Search code examples
iosobjective-ciphoneiboutlet

Outlets are showing nil


I outleted some views and buttons. and make synthesised to it on .m file. outlet properties are (strong,nonatomic) though when I try to access it on viewwillappear it is showing (nil). Can anyone help me that how could I access it? thanks in advance.


Solution

  • Go into your Storyboard file, right-click on the offending control, and make sure that you have a variable name shown under "Referencing Outlets".

    If it's not... the control isn't bound to a variable, and that'd explain your nil.

    enter image description here

    You can also go into your .h file, and check that your IBOutlets all have filled in circles to the left of them. This also tells you that they are bound to a control.