Programming iOS - Developing Applications for iPhone and iPad

1/7/2015 through 3/18/2014
10 class meetings with no class meeting on 2/18/2015.
6:30pm to 10:00pm Wednesday nights.

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 and Swift programming languages 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 - Core Location and MapKit, Testing and Over the Air Deployment - 3/25/2015s

In this lecture, we cover more on Core Motion, Core Location and including maps into your applications with MapKit.


In class we spend some time with storyboards.

We look at the latest trends with analytics and crash reporting.

Homework 10 (Optional but highly recommended for owning the course material): Class Review, GPS and MapKit
  • Create a view-based application
  • Add a UITabbarController to the screen
  • 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. The list should be driven by a JSON file, either in the bundle or delivered from a server location like AWS or DropBox.
  • 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 - Documentation - Hardware:Screens, Accelerometer, Compass, Gyro - Core Motion - 3/18/2015

In this lecture, we covered documentation using the JDoc standard.

By following a few simple conventions, your documentation will become part of the help system in XCode, and you can automatically generate full documentation from your source code with tools like Doxygen, AppleDoc or HeaderDoc.

Most apps have a number of images included to support the UI, layout and basic functionality of the app. We covered issues related to the many screen sizes and aspect ratios that affect how images behave within the app.

We covered device hardware: Compass, Accelerometer, Gyro.
The Core Motion API was covered.

Homework 9 (Optional): Catch up on all the other assignments!
  • Go back and review your work from previous assignments. The fundamentals of any iOS app of any type can be found there.

Lecture 8 - Integrating audio and video into iOS Applications - 3/11/2015

In this lecture we cover integrating multimedia into an application using MPMovePlayerController.

See for an example of playing an .mp4 video file from the app bundle.

If you will stream video to the iPhone or iPad over cellular networks, you are required to send the video in HTTP Live Streaming (HLS) format. See the HTTP Live Streaming link as a starting point.

In class we demonstrate delivering both .mp4 data and HLS data from Amazon Web Services.

Handbrake is a great free application to encode video that is ready for an iOS app.

We cover including HTML5/CSS/javascript content (including video) into iOS applications.

Homework 8: Integrating video into an application
  • Record a video of something G-Rated and interesting.
  • Encode the video to .mp4 format using Handbrake.
  • Create a tab-based application with three tabs
  • Include the video in both tabs, one tab using MPMoviePlayerController and the other tab using HTML5 video tag in the HTML displayed by UIWebView
  • Encode your video into an HLS stream, and deliver it from an Internet server, such as an S3 bucket, a dropbox folder, Google drive, etc.

Lecture 7 - Internet resources wrapup, Network connections with sockets and GameKit - 2/25/2015

In this lecture we wrap up our discussion of accessing resources on the Internet.

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.

In class we demonstrated a custom URL scheme, which allows your app to be opened from links on web pages or from an email.

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 7: Network Sockets


Write a basic iPhone messenger application using CocoaAsyncSocket that communicates with another device over network Sockets. Whatever you type on the phone will appear on the other device, and whatever you type on the other device will appear on the phone. Try to use at least one of the following:
  • Purchase an Arduino or a Raspberry Pi and setup sockets communication between an iPhone app and the device
  • A Sockets javascript application in a web browser running the Sockets.IO javascript library
  • A Mac Sockets application written in Python
  • A Mac Sockets application written in Ruby (pre installed on Mac OsX)

Reminder - No class next week, 2/18/2015

Lecture 6 - Internet resource access, storing documents, JSON and XML Parsing - 2/11/2015

In this lecture, we look at practical methods of interacting with data downloaded from Internet servers.

Topics Include:

Asynchronous download of JSON Data
Delegating data download to a self contained Class
Integrating cloud technologies - setup of Ubuntu Apache Web Server using AWS, PHP and MYSQL
Parsing JSON Data into objects

In class tonight, two open source network frameworks were mentioned, and ASIHTTPRequest. It might be good to download these for an example of how to build networking code, for a handy resource to include within your app, and because they are popular and you may run into a need to support them.

In this video the setup of a new PHP/MYSQL webserver at AWS is demonstrated.
Direct link to the file:iphone-aws-demo.mp4

Homework 6: Parsing a JSON feed
  • Create a view-based application
  • Use Grand Central Dispatch (GCD) to download the JSON feed we created in class at:
    or a feed or datafile that you create.
  • Parse the JSON data into an array of custom objects or an array of NSDictionary objects using Apple's NSJSONSerializer Class
  • Add a UITableView to the screen to display the parsed data
As a bonus, you might want to mess with downloading our slow image in a background thread: .

Lecture 5 - View Gestures, Custom View Drawing, CALayer - 2/4/2015

In this lecture, we continue to look at drawing within our own custom UIView objects. The drawRect method of a custom UIView provides a context into which you can add objects using the Core Graphics C library. The Core Graphics API is known as Quartz, Quartz 2D or QuartzCore.

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

Behind every UIView is at least one CALayer object exposed as the .layer property. CA (Core Animation) layers provide a rendering pipeline for the contents of a UIView that is handled by the onboard graphics chips, freeing up the CPU for other tasks. CALayer also calculates intermediate positions of UIView objects when you change a property within an animation block. Core Animation Programming Guide at is a great reference for Core Animation in general and in getting started with CALayer objects.

CALayer objects are quite similar to UIView objects (frame, subViews/subLayers). The main difference is that a CALayer object will not handle touch events, and they tend to have a lighter footprint and be faster to render.

Don't forget to import <QuartzCore/QuartzCore.h> as you start to work with CALayer objects.

Homework 5: Custom View Drawing
In this lab, you will investigate drawing custom UIView objects with Core Graphics and CALayers. 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 with a clock face image named ViewClock
  • Setup an NSTimer to fire a method every second
  • Using core graphics, draw a second hand that updates to the correct position every second
  • Add four instances of the ViewClock class on the screen in random positions of random sizes
  • Bonus points: Create a second ViewClock class that uses CALayer objects instead of drawRect

Lecture 4 - UINavigationController and UITabBarController - 1/28/2015

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

UINavigationController is a class that maintains a stack of view controllers, and presents the user with the option to move deeper into a hierarchy of data, then move back up the hierarchy by using a back button. Generally as you navigate up and down the stack, the .view property of the UIViewController slides in from the right, and slides off the right hand side of the screen as you navigate back.

UITabBarController is best used when you have distinct sections in your application. Each tab may have a different look at the same data, or it might be completely distinct, such as a "Settings" page.

The "Music" app and the "App Store" app are good examples of applications that make extensive use of both tabs and a navigation stack. Please spend some time in these apps, paying attention to layout and behavior of the UI elements.

To present anything on the iOS screen, it is important to have a clear understanding of the UIViewController Class instance methods:
  • -initWithNibName:Bundle
  • -loadView
  • -viewDidLoad
  • -viewWillAppear
  • -viewDidAppear
  • -viewWillDisappear
  • -viewDidDisappear
and properties:
  • .view
  • .title
  • .parentViewController
  • .navigationController
  • .tabBarController

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 view-based template.
  • Wipe out the storyboard file
  • Delete the info.plist entry for the "Main" storyboard file
  • In didFinishLaunching, it is important to setup the UIWindow properly. See the demos from day4 for examples.
  • 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. You will need the UIScrollViewDelegate for this to function correctly.
  • On the third tab, display a UIWebView implemented as the .view property of a custom UIViewController. Display your favorite g-rated website in the view.

As a tip to help you complete the lab, consider implementing each view in a small application independently. Only add the UIViewController to the UITabBar application after it 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 source code into the final tab based application.

Lecture 3 - Foundation collection Classes, delegation introduction - 1/21/2015

In this lecture, Foundation classes are covered in more detail. The design patterns of delegation that allows objects to communicate with each other is discussed. The delegate design pattern is demonstrated through implementation of a basic UITableView object and through implementing a .delegate property on a custom class.

This link to the Cocoa Fundamentals Guide at is largely targeted to the Mac platform. It is a nice overview of the communication mechanisms found in Cocoa:

Homework 3: Investigating delegation and the UITableView

The purpose of this homework assignment is to gain more practice working with Objective-C and the Foundation classes. Additionally, it will help you to become more familiar with delegation and the UITableView class.

Hopefully you will have fun with the assignment and will experiment outside of the homework requirements, for example by adding a custom view to the UITableviewCell or by changing the appearance of the cell. This one could take up some time as some of the concepts may be unfamiliar.

  • Create an iPhone or iPad application using view-based template
  • Add an NSArray of items to be displayed on the screen
  • Add a UITableView to the screen
  • Add the appropriate delgation methods to support the UITableView drawing
  • After you get it working, use the appropriate delegate method to change the height of each UITableViewCell to be 100 points.

This assignment will take some time, but will be a foundation for many iphone projects.

Video: Homework 3 - Delegation and UITableView

Lecture 2 - More Objective-C, Specialized UIView Objects, Target/Action - 1/14/2015

In this lecture, we review the startup process of an iOS application from main() to the UIApplicationDelegate's application: didFinishLaunchingWithOptions: method. We continue to investigate Objective-C and Swift classes including methods and properties.

The UIView hierarchy is reviewed, and a few specialized UIView objects are demonstrated.

The target/action pattern is introduced and an example of this pattern is demonstrated with a UIButton.

This wikipedia link on Target/Action might be interesting to check out. The 'target' of the UIButton will typically be the UIViewController, and the 'action' will be a method that has been defined by the programmer in the UIViewController.

Homework 2: Specialized UIViews and Target/Action
  • Create an iphone application using the view-based template
  • Place a UITextField, UILabel and UIButton into the view hierarchy
  • Define a method that reads the contents of the UITextField and sets the .text property of the UILabel
  • Use target/action on the UIButton to call your method when the TouchUpInside event is fired

Lecture 1 - iPhone/iPad Platform and Objective-C - 1/7/2015

In this lecture, a sampling of practical iOS development is demonstrated. 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

Swift is a programming language release with iOS8. It is a more modern language and is similar to Java and C#. Devices must be running at least iOS7 to support a swift application.

The Apple Swift website is a good place to start learning about Swift programming for iOS, as well as the Apple WWDC Site.

The following Swift concepts and keyword should be reviewed:
  • var
  • let

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 6.0.1. This will likely need to be updated before our class is over.
  • Create an iphone application using the "Single View Application" template.
  • Display a red UIView object on the screen.
  • Add a touch event to move the UIView around the screen
  • Repeat once for Swift and once for ObjectiveC
  • Zip up the project folders and email them to Dave.
  • See the video(s) below for help!

Video: Homework 1 - Getting Started with Objective-C and Swift
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