Search code examples
iphoneobjective-cinitviewdidload

InitWithNibName and viewDidLoad?


Possible Duplicate:
initWithNibName VS viewDidLoad

I'm new at iOS development. I would just like to know the main differences between these 2 functions ?

Thanks for your help


Solution

  •     viewDidLoad
    

    Is called when the view loads and is initiated/Unarchived and loaded into the memory. This is a great customisation stop.

     initWithNibName:
    

    Is used for initializing a certain class ( it is an overriden init method) with a xib file's name, the bundle parameter specifies the location of the file, you would pass nil for the main bundle, which is the projects folder.

    You should set up your properties in the viewDidLoad. The initWithNibName: is something that you call when you create a controller instance from a nib File. I wouldn't put customisation code there.