Using Xcode 4.2, in my application, a view loading is triggered by a segue event. What method will be called first inside a view controller?
-(void) viewWillAppear:(BOOL)animated works, but is it the first?
Initialization happens from the Storyboard it seems, init method is never manually called, upon object creation.
Let me clarify, when creating an instance of a class manually, we usually [[alloc]init] it first. [init] in this case, is the first method to be executed and a good place for various initializations.
What is the equivalent of init method when class instantiation happens via a segue event? In such a case, what method should contain all initialization logic?
I think the best option is
-(void)awakeFromNib. This only occurs the once, whereasviewWillAppearandviewDidLoadetc could be called more than once after your initialisation.UPDATE: As pointed out by Jean-Denis Muys below,
-(id)initWithCoder:(NSCoder *)decoderis a better option for an initialiser that only gets called once as-(void)awakeFromNibhas the potential to be called more than once.