cs193p – Lecture #5 – View Controller Lifecycle

Please note, this blog entry is from a previous course. You might want to check out the current one.

Lecture #5 starts with an introduction to text views and – new to iOS 7 – text storages and TextKit followed by a short demo.

The view-controller life cycle consists of the following steps:

  • the view gets instantiated e.g. from storyboard
  • awakeFromNib is called, which you could compare to init
  • the outlets get set
  • viewDidLoad is called, which can be used for basic setups
  • geometry is determined
  • viewWillLayoutSubviews and viewDidLayoutSubviews are called
  • viewWillAppear and viewDidAppear are called
  • viewWillLayoutSubviews and viewDidLayoutSubviews are called
  • viewWillDisappear and viewDidDisappear are called
  • didReceiveMemoryWarning is called when memory gets low


viewDidLoad is used in short demo, which also shows further insights into attributed strings.

Using notifications it is possible to tune in into certain “radio stations” and trigger actions when certain states arrive. Don’t forget to “tune out” when done …

… which is shown in another demo at the end of the lecture.

The code for this lecture is available at github as well as from Stanford.

The lecture as well as its slides are available via iTunes called “5. View Controller Lifecycle”.

Facebooktwittergoogle_plusredditpinterestlinkedintumblrmailFacebooktwittergoogle_plusredditpinterestlinkedintumblrmail

Flattr this!

Leave a Reply

Your email address will not be published. Required fields are marked *