Skip to content

Instantly share code, notes, and snippets.

@dimitardanailov
Last active July 21, 2017 11:30
Show Gist options
  • Save dimitardanailov/a4e14b822a67fcaadcecf9ae5b77cfd2 to your computer and use it in GitHub Desktop.
Save dimitardanailov/a4e14b822a67fcaadcecf9ae5b77cfd2 to your computer and use it in GitHub Desktop.
View Controller - Lifecycle
viewDidLoad

After instantiation and outlet-setting, viewDidLoad is called. This is an exceptionally good place to put a lot of setup code

- (void)viewDidLoad
{
  [super viewDidLoad]; // always let super have a chance in lifecycle methods
  
  // do some setup of my MVC
}

But be careful because the geometry of your view (its bounds) is not set yet!
At this point, you can't be sure you're on an iPhone 5-sized or an iPad or ???
So do not initialize things that are geometry-dependent here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment