Programming iOS - Developing Applications for iPhone and iPad

3/2/2014 - 6/11/2014

If you are a developer who wants to write applications that run on the iPhone or iPad, you should attend this class.

In 10 evenings, Programming iOS will teach you to create iOS applications like the ones you use on your iPhone every day. The class focus is on solid iOS Programming fundamentals which will serve you well in any context.

After an introduction to the Objective-C language and the Foundation framework, we look in depth at the tools and the Classes that make up the iOS UI framework. We draw on the screen using UIKit, Core Graphics and Core Animation. We cover multi-touch event handling and the setup and configuration of a server in the cloud at AWS (Amazon Web Services) to support backend components of iOS applications. Your class assignments will interact with this server in a practical and real-world manner.

This course can be taught onsite for your company. Dave has taught this class for, LiveNation/TicketMaster, and many other smaller companies and individuals.

Lecture 10 - Cross-Platform development/HTML5 Integration, CoreMotion, Over the Air (OTA) Deployment - 6/11/2014

In the last lecture we have a lot to cover. I'm hoping you have enjoyed the class and are leaving with the fundamental concepts needed to tackle any iOS project.

First we look at cross-platform development and HTML5 Integration. We will briefly discuss integrating third party libraries such as Flurry analytics (highly recommended) and crashlytics (highly recommended).

Next we cover the Core Location API and related hardward: GPS and Compass.

Core Motion API with the Accelerometer and Gyro are covered.

In class, we will demonstrate an Over The Air (OTA) deployment - providing a downloadable link for remotely installing an app on devices for testing purposes.

Homework 10: Class Review, GPS and MapKit (Optional and involved, but highly recommended)(I have found some great Los Angeles restaurants from this assignment in the past!)

  • Create a UITabController-based application
  • On Tab 1, display raw GPS and compass data onto labels on the screen.
  • On Tab 2, display a UITableView with one row for each of your favorite restaurants.
  • When a restaurant is selected, push a MapKit view onto the screen, showing your current location and the location of the restaurant.
  • Consider adding a sectioned tableview with different sections based on categories like the style of food, rating or price.

Lecture 9 - Network connections with sockets and GameKit - 6/4/2014

In this lecture we cover networking with sockets in the iOS environment, looking at a third-party library called CocoaAsyncSocket which helps wrap the sockets classes. The GameKit classes will also be covered.

Links that are related to tonight's lecture:

NodeJS - Host javascript socket servers
CocoaAsyncSocket - open source sockets library
Arduino - open source hardware device
Raspberry Pi - small Linux box on a board
CFNetwork Programming Guide

See the demos below from class: - uses CocoaAsyncSockect to send a UDP packet to an Arduino - Arduino socket server example - iPhone app client of a node.js server - node.js source for a simple socket server - node.js source for a simple web server

Homework 9: Sockets and GameKit

Happy Thanksgiving. There is no official homework assignment for this lecture.

This would be a good time to catch up with family, then catch up on previous homework assignments.

Optional (and recommended) exercises:
  • Write an application that communicates through a socket to Node.js running on your MAC or on an external webserver
  • Pick up and Arduino or a Raspberry Pi and setup sockets communication between an iPhone app and the device
  • Setup Sockets communication between a web browser running the Sockets.IO javascript library and an iPhone app
  • Write a simple mac application in Python and communication with an iPhone app over Sockets
  • Write a sockets server in Ruby (pre installed on Mac OsX) and communicate with an iPhone application

Lecture 8 - Multithreading and Practical Internet Resource Access - 5/28/2014

In this lecture we continue to investigate accessing Internet resources.

Downloading data from the Internet tends to be slow and unreliable, so it is generally best to perform this operation on a background thread. This can be accomplished in a number of ways, including:
  • Leveraging background thread handling of built-in classes
  • starting up and managing your own threads
  • using NSOperation and NSOperationQueue
  • using the Grand Central Dispatch API (GCD) and the "blocks" language feature of Objective-C.

    See Day8-AsyncData for a practical example of downloading Internet data.

Homework 8: Reading slow images from a web server asynchronously
In this project you will downloading slow Internet data on a background thread while maintaining a positive user experience.

  • Add a UICollectionView to an ipad application
  • Download 15 instances of the slow image from our class server at
  • Set a different delay (in seconds) on each image
  • Leverage or modify the AsyncData Class from the Day8-AsyncData project to support displaying a proper UI to the user indicating network activity

Lecture 7 - Files and Internet Resources - 5/21/2014

In this lecture, we look at working with files delivered from webservers in the cloud.

Both the RackSpace and Amazon Web Services (AWS) file storage products will be used in class to deliver data to an iOS application quickly and efficiently.

Both NSString and NSData support loading from a file or from a URL. A URL can point to the Bundle, a directory such as Documents, or to an Internet resource over http: or https:. As an example, you might load and parse an XML file in the bundle with the following Objective-C code:
NSURL *url = [[NSBundle mainBundle] URLForResource:@"famousDrummers.xml" withExtension:nil];
NSData *bundleData = [[NSData alloc] initWithContentsOfURL:url];
NSXMLParser *parser = [[NSXMLParser alloc] initWithData:bundleData];
parser.delegate = self;
It will be important to download webserver data in a background thread instead of the main thread which runs the UI, which will free up the UI for interaction with the user.

Example projects below include: - demonstrates recording audio files and storing them into the Documents Directory - demonstrates parsing XML files, both locally and from a web server - demonstrates reading and writing from the bundle and from the Documents Directory

Homework 7: Part 1 - Parsing a JSON document from a webserver
  • Add a UITableView to an iphone application
  • Download the JSON document from the server we setup in class at:
  • Parse each of the nodes from the document into a NSArray of objects
  • Display the contents of the array on the UITableView
Homework 7: Part 2 - Parsing a static document from cloud storage
  • Create an account at one of the major cloud services: AWS, Rackspace, Azure. (how about all three?)
  • Place a simple static XML document into the cloud.
  • Parse the XML document into an array of objects, then display them on the screen as you see fit.

Lecture 6 - More view drawing, Animation with NSTimer and with CALayer - 5/14/2014

In this lecture we will wrap up our discussion of custom UIView drawing.

UIGesture and the touch events will be reviewed.

Animation techniques will be covered in class, including:
  • NSTimer and target/action
  • UIView Animation, with UIView blocks and with the "blocks" language feature
  • UIImage Animation
  • Core Animation and CALayer, CABasicAnimation and CAKeyframeAnimation
The .layer property of type CALayer behind every UIView object provides smooth hardware-accelerated animation. The CALayer Class also provides for helpful properties that affect views, such as rounded corners and dropshadows. CALayer Classes work much like UIViews in that sublayers are supported.

Core Animation Programming Guide at is a great reference for Core Animation. Also Ray Wenderlich's CALayer Tutorial and UIView Animation are worth looking at.

A project called CALayerAnimTest downloaded from will be demonstrated and discussed.

and Core-Animation-Demos from Bob McCune will be demonstrated and dicsussed: .

Homework 6: Animation Techniques
  • Add four custom UIView objects to an iPad application
  • Inflate and shrink view1 using CABasicAnimation when it is tapped
  • Bounce view2 using CAKeyframeAnimation when it is touched
  • Continuously rotate view3 using NSTimer and target/action
  • Place a linear gradient at the base of view4, then use UIView block animation to change the position of view4 when it is double tapped
Be sure to take some time and experiment with the types of animation that can be performed, play with the parameters, and investigate the properties of CALayer.

Lecture 5 - Custom View Drawing - 5/7/2014

In this lecture, we look at the drawRect method of a custom UIView.

We will use Core Graphics C library to draw custom shapes into the UIView. Sometimes people refer to the Core Graphics API with the name Quartz or Quartz 2D.

See the Quartz 2D Programming Guide at for more in depth information about working with Core Graphics.

Homework 5: Custom View Drawing
In this lab, you will investigate drawing custom UIView objects with Core Graphics. Many of the more creative iphone and ipad applications use this technique to create a unique and dynamic user interface.
  • Create an ipad application using the view-based template
  • Implement a custom UIView class name PolyGon with a property named numberOfSides
  • Using the .frame.size property, draw the polygon with a line size of 4 points
  • Derive a class named Square from the PolyGon class, and override the setter for the numberOfSides property to make it read-only
  • Draw four instances of the PolyGon class on the screen in random positions of random sizes and shapes
  • Draw one instance of the Square class on the screen in a random position and size
  • Change the position and size of the objects on the screen in the touchesBegan event of the UIViewController
  • Bonus points:implement a lineColor property and a fillColor property

Lecture 4 - UINavigationController and UITabBarController - 4/30/2014

In this lecture, we look mainly at classes that act as parents to UIViewControllers.

Homework 4: UITabBarController
In this lab, you will investigate UITabBarController, which contains an array of UIViewControllers. The UITabBarController manages the display of the .view property of each UIViewController held on each tab.
  • Create an iphone or ipad application using the "empty" template.
  • In didFinishLaunching, Implement 3 Custom UIViewControllers and add them to a UITabBarController.
  • Place the UITabBarController.view onto the screen as the rootViewController property of self.window.
  • In the first tab, implement a UINavigationContoller that holds a UITableView. Slide in a detail screen when a row is clicked.
  • On the second tab, display a scrollable UIImageView with a world map that is larger than the physical screen on the device.
  • On the third tab, display a UIWebView implemented as the .view property of a custom UIViewController

As a tip to help you complete the lab, consider implementing each view in a small application independently. Add it to the UITabBar application after it the UIViewController is complete and working properly.

For example, make a simple view-based app with a scrollable image. After it is working properly, drop that view controller into the final tab based application.

Don't forget to investigate the UIScrollViewDelegate protocol.

Lecture 3 - Delegation and UITableView - 4/23/2014

In this lecture, we discuss the delegation design pattern. Here is a link to the Apple docs that discuss delegation in Cocoa: Delegation.

To summarize delegation, an object delegates the responsibility to handle an event to some other object it has a reference to.

You will often find that a user interface object becomes much more re-usable if it defines a delegate or a datasource by using a protocol.

UITableView is a great example of delegation. The UITableView object asks its delegate for just about every aspect of its data and its behavior. The UITableViewDelegate and UITableViewDataSource protocols define the set of methods that a UITableView object will be calling on its delegate.

In this video a basic UITableView is demonstrated. 17.2MB 9:34

Homework 3: Table View
  • Create an iphone application using the empty template
  • Add your own UIViewController
  • Place a UITableView onto the .view property of your UIViewController
  • Populate the UITableView with the contents of an NSArray.

No Live Stream Tonight - 4/16/2014

Video: Announcement of no live stream tonight

Lecture 2 - UIView and UIViewController - 4/9/2014

In this lecture, the UIView and UIViewController class are investigated in more detail.

Specialized UIViews are presented.

The touch events are covered as well.

Homework 2: Using UIView and UIViewController classes
  • Create an iphone application using the "empty" template
  • Implement a custom UIViewController class that displays three UIView objects as follows:
  • View 1: UIView with a repeated image pattern in the background
  • View 2: A red UIView object that spins when you touch the screen
  • View 3: A UIWebView with your favorite g-rated website displayed
Video: Homework 2 - Part1 (starts about 30 seconds in)

Lecture 1 - iPhone/iPad Platform and Objective-C - 4/2/2014

In this lecture, a sample application named 'learning-ios-first-app' is created to introduce the Objective-C language and its basic elements.

Objective-C is an programming language that features extensions of the ANSI C language. These extensions that have been added are mostly centered around object-oriented programming: creating Classes and working with methods on the Classes.

The following Objective-C syntax extensions should be reviewed:
  • @interface
  • @implementation
  • @property
  • [ ] (square brackets)
  • #import
  • - (minus sign to mark an instance method)
  • + (plus sign to mark an class method)
  • The @ sign as a shortcut - for example, @"Hello, World" creates an instance of an NSString

Homework 1: Contact Info, Setting Up Your Development Environment, Basic App
  • Send an email to Dave at with iOS in the subject line. This is important so your email address can be whitelisted.
  • Install the current production version of XCode - Version 5.1. This will likely need to be updated before our class is over.
  • Create an iphone application using the "empty application" template.
  • Display a red UIView object on the screen.
  • Zip up the project folder and email it to Dave.
Video: Homework 1 - Getting Started

Back to Top

XCode Projects - Class Demos, Examples and Homework Answers


Class Logistics

Previous Versions of iPhone and iPad iOS Development class

External Links

home Site Map Terms of Use Privacy Policy Client Directories