iPhone and iPad SDK Programming Class

April, 2001

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 9 - Performance and Multithreading

In order to keep the UI responsive to the user, it is sometimes required to perform tasks on threads that are separate from the main thread. The main thread controls the UI display and handles touch events. In this lecture, we look at the different techniques of creating and managing those threads.

Grand Central Dispatch is a C-based API that allows you to take a block of code and execute it by dropping the code into a work queue for later execution. Grand Central Dispatch makes extensive use of a language feature called 'blocks'.

Examples and Demos related to this topic:
Example_Blocks_Enumeration.zip - Demonstrates using blocks to enumerate through an NSDictionary of objects
ClassDemo_AsyncWeb.zip - Demonstrates downloading pictures from the Internet using blocking and non-blocking techniques
Example_AsyncText.zip - Demonstrates download of a text file from a web server asynchronously

External Links:
http://thirdcog.eu/pwcblocks/ - Really nice doc describing blocks from Joachim Bengtsson
http://en.wikipedia.org/wiki/Grand_Central_Dispatch - wikipedia is the best

Homework 9: Create a view-based application with three buttons and a UIImageView. Each button click should download an image from the Internet using a different technique. Button One should be simple code that blocks the main thread from executing. Button Two should download the image NSURLConnection's delegate callback methods. Button Three should download the image through Grand Central Dispatch.

Lecture 8 - OpenGL and Cocos2D Framework

In this lecture we look at OpenGL ES. OpenGL tends to be quite time consuming to work with so the free-of-charge open source Cocos2D Framework is presented as a alternative to using raw OpenGL for animated two dimensional game development.

Homework 8: Download and install the Cocos2d Framework. Using the framework, create two sprites that cross the screen, collide, and are destroyed upon collision.

Bonus Challenges: play a sound when the sprites collide. Play background ambient sounds while the application is running.

Lecture 7 - Files and Data, Sounds

In this lecture we look at retrieving files from the bundle, and reading/saving files from the documents directory. The APIs used to add sounds to an application are discussed.

Homework 7: Use an XML file in the bundle of your application to store the location of three custom views on the screen. When the application starts, read the xml file to create the frames for the three views. Make each view play a short sound when it is touched.

See RSSReader example for help with getting access to the bundle directory, loading up, and reading an XML File.

Lecture 6 - Quartz/Core Graphics Wrapup and Core Animation

In this lecture we discussed Core Animation, and looked at using NSTimer to set up an animation loop that leverages a custom drawRect method of a view.

Homework 6: Add animation to homework 5, with the stars being placed outside the view of the screen, and animating in to their final position.

Lecture 5 - UITableView, Custom View Drawing with Quartz/Core Graphics

In this lecture we look deeper into UITableView and the delegate protocols that are used by the UITableView. Custom view drawing is discussed.

Homework 5: Create a view-based application that displays a random number of custom views in random position on the screen whenever the screen is touched. The custom view should draw a star shape using Core Graphics.

Bonus Challenges:Try animating the position of the custom views as they appear on and off the screen. Try playing a simple short sound as each view reaches it's final resting place and as each view is destroyed. Try adding a simple Hanna-Barbara style bounce animation as the start view reaches it's final position.

Lecture 4 - View Controller Container wrapup, iPhone Graphics, Protocols and Specialized Views

In this lecture we look deeper into view controller containers, investigate required graphics for a polished iOS application, cover protocols as a means of communicating betwen components, then look at specialized views such as the UIWebView.

Homework 4: Create a tab based iPhone application. On tab1, have a navigation based MVC. On tab2, display a scrollable UIImageView of the United States. On tab3, display a UIWebView with your favorite non-offensive website. Include the iPhone graphics to add some polish, including the icon and the startup screen.

Lecture 3 - View Controllers and MVC

In this lecture, MVC constructs were reviewed and view controllers are presented. The delegation pattern was presented.

Homework 3: Create a basic navigation-based iPhone application. When a row is clicked, another view controller should be pushed onto the navigation stack that displays information about the row that was selected.

Lecture 2 - Objective-C and Foundation Classes

In this lecture, Objective-C is tied to the iOS platform. It is demonstrated how the main method passes control to the UIApplicationDelegate Class Which loads the main window (often through a .xib or "nib" file) and adds any subviews that are needed.

Homework 2: Create a basic view-based iPhone application, and display some text on the view from a custom Objective-C Class. You will complete the exercise twice, once with a "window based" application template as a starting point with no xib files, and another using a "view based" template and xib files.

Lecture 1 - iPhone/iPad Platform and Objective-C

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

Objective-C is an extension of the ANSI C language. It has been extended to include certain features centered around object oriented programming.

Homework 1: Send me an email, Install the iPhone SDK, Read the Objective-C Primer Listed below.

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


All XCode Projects - Class Demos, Examples and Homework Answers

Previous Versions of this class

All Class Videos

core-graphics-ipad-custom-drawrect-computer.mov
59MB, 14:00, 5/11/2011 - Demonstrates using a custom view, Core Graphics, and drawrect to display a random number of stars on the screen
xcode-projects-previous-versions.m4v
32MB, 5:38 - Things to look at when converting xcode projects from previous versions, such as tutorials or examples from the web.
Homework2_UIView_Text.m4v
29MB, 7:08 - Records the process of completing homework assignment 2, displaying information from a custom Objective-C class in a UIView.
Homework_Beverages.m4v
177MB, 10:57 - Records the process of completing homework assignment 1, a command line tool to display information about your five favorite beverages.


From July 2010:

ClassDemo_Homework1Answer.m4v
ClassDemo_Homework3Answer.m4v
ClassDemo_HomeworkAlbumwindow
classdemo_objectivec.m4v
ClassDemo_TableViewBasics.m4v
iphone-sdk-basics-core-graphics.m4v
ipad-touchable-views.mp4


All Class Slides

Class Logistics

home Site Map Terms of Use Privacy Policy Client Directories