On Sun, May 10, 2015, at 11:58 AM, Sasikumar JP wrote: > Hi, > > I am observing outlets are nil after the awakeFromNib call in my > viewcontroller which is created from the storyboard. > > As per the apple documentation, awakeFromNib will be called after > initialising all the objects and outlets for a view controller from nib. > > i hope awakeFromNib is valid for storyboard too.
You almost certainly want to override -viewDidLoad rather than implement -awakeFromNib on your view controller. (This is true regardless of whether you're using storyboards.) When your storyboard is compiled, your view controller is archived separately from its view. Therefore, when your view controller gets -awakeFromNib as part of being unarchived, none of its outlets can possibly be set up, because the view is in a different archive whose loading has not been triggered yet. On OS X, your view controller might get -awakeFromNib _a second time_ when its view is unarchived during -loadView, at which point its outlets will be hooked up. That depends on whether or not OS X storyboards use the new "prefer coder" unarchiving behavior, which is an implementation detail. On iOS, you won't get a second -awakeFromNib, since UINib has never sent -awakeFromNib to File's Owner. --Kyle Sluder _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com