iPhone and iPad SDK Programming Class

Programming the Apple iPhone and iPad devices using the IOS SDK can be challenging for beginners, but rewarding. This class covers a broad overview of iPhone and iPad programming, including a coverage of Objective-C, UIKit framework, and other frameworks needed for successful completion of iOS projects.

Lecture 11 - Networking and Device Hardware:Camera, Accelerometer, GPS, Compass, Gryo, Core Location

In this lecture, we will look at networking in iOS. In part two, we will focus on the hardware including the camera and location based hardware.

Homework 11: Read an XML file which stores the name and location(latitude, longitude) of your favorite restaurants in Los Angeles. Display the restaurants and your current location on a map. Display the current temperature asynchronously on the screen as given to you from my arduino at http://arduino1.certifiednetworks.com

Lecture 10 - Audio and Video on iOS

In this lecture, we looked at methods playing and recording audio and displaying video. A demonstration was given that demonstrated uploading .mp4 video to Amazon S3 and displaying it on a UIWebView using HTML5.

Homework 10: Attempt to play audio in an application using System sounds and one other API, such as AVAudioPlayer.

Lecture 9 - Concurrency and Multithreading - Keeping the UI Responsive During Background Processing

In this lecture, we looked at methods of keeping the UI Responsive during background processing. In a practical sense, this generally means downloading content from the Internet on a background thread.

Techniques include: creating your own NSThread objects, using NSOperationQueue and NSOperation, using builtin delegate callback mechanisms of NSURLConnection, and Grand Central Dispatch. The 'Blocks' Objective-C language feature was discussed as an introduction to Grand Central Dispatch, which is a C-based API that leverages Blocks to place tasks into a queue for processing on other threads.

Example projects:
Example_Asynch.zip - very practical method of pulling content from the Internet using NSUrlConnection
DownloadMobyDick.zip - demonstrates my favorite way of pulling text from the Internet in the background
UCLAClassNine.zip - demo from class of refactoring blocking code using Grand Central Dispatch (GCD)
ClassDemo_AsyncWeb.zip - mostly functional attempt to show all techniques of background thread processsing such as NSOperation

This is a challenging and very important topic. Here are some resources to help:
iTunesU - Developing Apps for iOS(HD) - Paul Hegarty, Stanford, Lecture 13 - Blocks and Multithreading, 1 hour 6 minutes.
Concurrency Programming Guide, Apple
iTunesU - Advanced iPhone Development Spring 2010 - Dr. Brad Larson, Madison Area Technical College, Lecture 8 - Multithreading, 2.5 hours

Homework 9: Call a resource from the Internet and use that resource in your application. For example, call a large image and place it in a UIImageView or call an XML file and load it into a UITableView.

Start with a simple blocking call, then incorporate Grand Cental Dispatch to keep the UI functional during the download. Repeat the process using NSURLConnection and the delegate callback. Optionally incorporate at least one other technique such as NSOperationQueue to perform the same task.

Lecture 8 - Files and XML Parsing

In this lecture, we looked at various methods of reading and writing files in iOS. Example projects: Example_Files.zip, Example_Settings.zip, RSSReader.zip, Example_JSONDynamic.zip, Example_TableViewFromTextFile.zip.

Parsing XML files was also covered. There are two common XML parsing techniques, DOM and SAX. In class, we looked at the built-in NSXMLParser class which uses the SAX model involving callback methods to the delegate as the file is parsed.

Homework 8: Read an XML file from the bundle, the documents directory or a server. The XML file should describe at least three views that will be placed on the screen. Properties described in the file might include background color, the center position, the bounds of the view, rotation, velocity of animation, etc. Start small and work up. RSSReader.zip will be quite helpful in completing the exercise.

Consider rewriting the application three times using three different XML parsing techniques. You might try NSXMLParser, lib2xml, and an open source framework such as TinyXML. You might try writing the application again using a plain text file that describes the views.

Lecture 7 - Custom Animation

In this lecture, we look at various methods of animating objects on the screen.

UCLAWeekSeven.zip demonstrates most of these techniques. Animations.zip demonstrates a CAAnimation object with more custom animation paths.

Homework 7: Create an ipad app with two custom views on the screen. When each view is tapped, it should drop as if pulled by gravity.

Lecture 6 - Custom View Drawing

In this lecture, we looked at custom view drawing using the Core Graphics API in the drawRect method of a custom UIView.

ViewDemo.zip demonstrates custom drawing from a UIView.

Homework 6:

Create an iPhone application using the view-based template. Implement a custom UIView using the drawRect function.

Lecture 5 - UINavigationController, UITabBarController, Custom View Drawing

In this lecture, we reviewed the uses of the Init method and implemented our own delegate in completing homework assignment 4. See Homework4Answer.zip. A UINavigationController was implemented in NavDemo.zip and a UITabBarController was implemented in TabDemo.zip. The graphics have been updated in the demo to make up for my lame graphics skills.

ViewDemo.zip demonstrates custom drawing from a UIView, which will be covered in depth next lecture.

Homework 5: UITabBarController and UINavigationController

Create an iPhone application using the view-based template. Implement a UITabBar with at least two tabs. Tab one should implement a UINavigationController as it's main view. Tab two should implement a UIWebView pointing to your favorite non-offensive website.

Lecture 4 - Delegation, UIViews, Touch Events

In this lecture, we reviewed delegation by fixing and completing homework assignment 3 for a fellow student. The completed project is posted as project3.zip.

We then spent some time looking at UIView objects and their properties, drawing to the screen, touch events and gestures.

See Class4Demo.zip for the example that was built during lecture.

Homework 4: UIViews and drawing to the screen

If possible, please update to the current version of XCode so the examples in class will be easier to follow.

Create an iPad application using the view-based template. You may optionally choose to include automatic reference counting. Create a custom class derived from UIView. Place an instance of that class onto the storyboard/.nib file. Modify a property of that view using code.

Additionally, you might practice with handling touch events and drawing multiple views. For example, if you touch a blank area of the screen, you add a new view. When you tap that view, it removes itself from the parent view.

Lecture 3 - Foundation Classes, drawing to the screen, delegation introduction

In this lecture, Foundation classes were covered in more detail. Design patterns that assist communication between objects were briefly discussed, including: delegation, notification, target/action and KVO (Key Value Observing). The delegate design pattern was demonstrated through implementation of a basic UITableView object.

This link to the Cocoa Fundamentals Guide at developer.apple.com 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 either the window-based or the view-based template. Add a UITableView to the screen that displays data you have stored in an NSArray. 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. See Day3.zip for a good example of the elements required.

Lecture 2 - iPhone/iPad Objective-C and Foundation Classes

In this lecture, we continued to look at the Objective-C language and some Foundation classes like NSString and NSArray.

The path of execution of an iOS app was followed from main.m to UIApplicationMain() to info.plist to MainWindow.xib to the delegate and finally to the AppDelegate class and the didFinishLoading method. See the s.zip project below for the project that was created during Class. The project was named with a small name so that it would display more nicely on the overhead and to make the Classes created by the template more clear.

Many of the concepts from lecture 2 are revisited in the video covering the Homework 2 solution below.
http://s3.amazonaws.com/certifiednetworks/video/iphone-sdk/Homework2-ucla-201110b.mp4 1024x768 30MB 10:58

Homework 2: Using a custom class
Create an iPhone or iPad application using the view-based template. Display information from a custom class onto an instance of UILabel. See HW2b.zip below for one possible solution.

Lecture 1 - iPhone/iPad Platform and Objective-C

In this lecture, the iOS Platform was introduced using the iPad and iPhone. The Objective-C language and its basic elements was introduced.

Objective-C is an extension of the ANSI C language which has been extended to include certain features centered around object oriented programming.
The following Objective-C extensions were discussed and should be reviewed: @interface, @class, @property, [] (square brackets), #import, - (minus sign to mark an instance method), + (plus sign to mark an instance method).

Homework 1: Getting Started
Send me an email. Read 'Learning Objective-C: A Primer' Listed below. Install the iOS SDK and XCode.
Create an iphone application using the view-based template. Display "Hello, World." on an instance of UILabel.

Apple Documentation - Objective-C, A Primer. http://developer.apple.com/iphone/library/referencelibrary/GettingStarted/Learning_Objective-C_A_Primer/

XCode Projects - Class Demos, Examples and Homework Answers


13.0MB, 05:35, 7/10/2011 - Demonstrates creating a universal app that displays two views. Walkthrough for the answer to homework 3.
23.7MB, 13:10, 7/6/2011 - Class demo using Interface Builder to set IBAction and IBOutlet links.
14.4MB, 06:05, 7/2/2011 - Demonstrates displaying a property from a custom class onto a view.


Class Logistics

Previous Versions of iPhone and iPad iOS Development class

home Site Map Terms of Use Privacy Policy Client Directories