[iOS 7 Stanford 2013 Fall] Lecture 1 Class Logistic, Overview of iOS, MVC, Objective-C

I started to go through the latest iOS 7 Development course by Stanford in 2013 Fall. This is the first lecture.

iOS Overview

Core OS (Miniatured OS X)

  • OSX Kernel
  • Mach 3.0
  • BSD
  • Sockets
  • Security
  • Power Management
  • Keychain Access
  • Certificates
  • File System
  • Bonjour

Core Services

  • Collections: NSArray, NSDictionary, NSSet
  • Address Book
  • Networking
  • File Access
  • SQLite
  • Core Location
  • Net Services
  • Threading
  • Preferences
  • URL Utilities

Media

  • Core Audio
  • OpenAL
  • Audio Mixing
  • Audio Recording
  • Video Playback
  • JPEG, PNG, TIFF
  • PDF
  • Quartz (2D)
  • Core Animation
  • OpenGL ES

Cocoa Touch (Touch Version of Cocoa)

  • Multi-Touch
  • Core Motion
  • View Hierarchy
  • Localization
  • Controls
  • Alerts
  • Web View
  • Map Kit
  • Image Picker
  • Camera

MVC

  • Three camps: Model, View, Controller
  • Model: What your application is
  • Controller: How your Model is presented to the user
  • View: Your Controller’s minions
  • It’s all about managing communication between camps
  • Controllers can always talk directly to their Model.
  • Controllers can always talk directly to their View.
  • The Model and View should never speak to each other.
  • Views talk to Controllers through “target-action”, which is “blind” and structured.
  • The Controller sets itself as the View’s delegate.
  • The delegate is set via a protocol.
  • Views do not own the data they display. So, if needed, they have a protocol to acquire it. The protocol this time is called data source.
  • Controllers are almost always the data source (not Model).
  • Controllers interpret/format Model information for the View.
  • Models uses a “radio station” like broadcast mechanism to inform Controllers update or something about Models.
  • Controllers (or other Model) “tune in” to interesting stuff.

Objective-C

  • A @porperty is just the combination of a getter method and a setter method in a class.
  • The getter (usually) has the same name of the property.
  • The setter’s name is “set” plus capitalized property name.
  • New iOS 7 syntax for importing framework

  • Using dot notation only for @property‘s setters and getters.

  • strong means “keep the object that this property points to in memory until I set this property to nil (zero) (and it will stay in memory until everyone who has a strong pointer to it sets their property to nil)”

  • weak would mean: “if no one else has a strong pointer to this object, then you can throw it out of memory and set this property to nil (this can happen at any time)”

  • nonatomic means: “access to this property is not thread-safe”.

  • Fast enumeration: for-in syntax. It works on arrays, dictionaries, etc.