whats the different between nibNameOrNil and ViewDidLoad methods?
whats os the difference between initWithNibName and开发者_如何学运维 ViewDidLoad methods ? can i use them both?
initWithNibName
- is what you call to create a view controller from specified nib file.
viewDidLoad
- is what system calls on your controller after the controller’s view is loaded into memory. You can implement this method to perform some additional initialization (which is not done in nib file)
I think you may be confusing things here. nibNameOrNil is (usually) an argument name, frequently for -initWithNibName:bundle:. As such, it should be the name of your nib (.xib) file. -viewDidLoad is a method, and is called after your viewController has had it's view instantiated for the first time.
精彩评论