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 12 - Camera, Core Image, GPS and Core Location - 3/27/2013

In this lecture we cover the camera and related classes, including applying Core Image filters and saving images to the photo library.

We will place a mustach on the instructor during a live video feed using the great example FaceDetectionPOC by Jeroen Trappers.

GPS and core location are covered, and will be discussed in the context of MapKit.

Thanks for a great class, it was fun for me and hopefully helpful for you.


Lecture 11 - Integrating Video and HTML5 into your application - 3/20/2013

In this lecture we wrap up our multimedia discussion by integrating video into an application using MPMovePlayerController.

See Example_Video.zip for an example of playing an .mp4 video file from the app bundle. Stanton Moore is a great drummer!

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

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


Homework 11: Video and HTML5

  • Record a video of something G-Rated and interesting.
  • Encode the video to .mp4 format using Handbrake.
  • Create a tab-based application with two 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


Lecture 10 - Audio Programming - 3/13/2013

In this lecture we covered audio programming focused mainly on AVAudioPlayer and AVAudioRecorder.

In a practical sense, the following audio APIs are available for iOS audio programming:

AudioServicesPlaySystemSound - Simple sound effects
AVAudioPlayer/AVAudioRecorder - Record and play longer sounds
MPMusicPlayerController - Play audio from your ipod library
Audio Units - Professional level audio recording, playback and streaming
Core Midi - Midi recording and playback through the camera connection kit or through wifi

See AudioRecorderAndPlayer.zip for the example we created in class, and see ConcertRecorder.zip for another example of recording .caf format to the Documents directory. See Example_VibrateMe.zip for playing a simple sound and playing a "vibration" (only works on the device, not the simulator).

Remember to reference The "afconvert" command line utility on a Mac will make a nice compressed .caf file from a .wav source that is great for iOS.

We demonstrated OneNode by Aran Mulholland as an example of Audio Units: One Node - Audio Units

Using Audio from Apple Developer is a great point to start your reading.

The following is an example of how to play a simple sound effect:

- (void)playNoise
{
NSString *soundPath = [[NSBundle mainBundle] pathForResource:@"noise" ofType:@"wav"];
SystemSoundID soundID;
AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath: soundPath], &soundID);
AudioServicesPlaySystemSound (soundID);
//[soundPath release];
}

Thanks to Channpal for the cool tabla demo! If anyone has any video of the performance, please let me know I would love a copy.


Homework 10: Audio

Homework assignment was late in being posted...sorry about that.

Try adding sound to a previous homework, perhaps on a touch event. You might consider AVAudioPlayer to play a longer .mp3 file from the bundle, MPMusicPlayerController to play sound from your ipod library, or AudioServicesPlaySystemSound to play a simple sound effect.

Lecture 9 - Network connections with sockets and GameKit - 3/6/2013

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

NodeJS - Host javascript socket servers
CocoaAsyncSocket - open source sockets library
Arduino - open source hardware device
CGNetwork Programming Guide


Homework 9: Sockets and GameKit

Option 1: Write an application that communicates with another device over GameKit. When you type a message into a UITextField, that message should be displayed on the screen of the other device. Display all text that comes across from GameKit in upper case.

Option 2: Write an application that communicates through a socket to Node.js running on your mac. Anything that is typed into a UITextField should be displayed onto the screen of any other device connected to the same socket.

Lecture 8 - Internet Resources - 2/27/2013

In this lecture, we look at practical methods of interacting with data dowloaded from Internet servers. We will look at:

Singleton Pattern
Caching Data
Asynchronous download of JSON Data
Parsing JSON Data into objects
Posting form data to websites


Example projects:
Day8InternetAdvanced.zip

Homework 8: Call a resource from an public JSON Feed.
Be sure to use Grand Central Dispatch to download the data in the background without blocking the main UI Thread. Example Feeds:


Lecture 7 - Files and Internet Resources - 2/20/2013

In this lecture, we look at methods of storing data and working with data downloaded from Internet servers.

Example projects:
Day7-Files.zip - the basics of files and Documents Directory
Day7-Internet.zip - demonstrates pull data from the Internet using Blocking techniques, NSUrlConnection and GCD
DownloadMobyDick.zip - demonstrates AsyncString, my favorite way of pulling text from the Internet in the background


Homework 7: Call a resource from an Internet cloud server 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.

If you really want to go crazy, download a JSON file which defines an array into a UITableView, and have an image element in the array downloaded as well.


Lecture 6 - iOS Animation - 2/13/2013

In this lecture, we will cover basic animation techniques available in the iOS SDK, including UIView animation blocks, Core Animation, UIImage animation, and a full run loop created with a scheduled NSTimer and DrawRect method of a custom UIView class.

CALayer is a class that is wrapped by UIView, and is important in providing smooth hardware-accelerated animation.

Core Animation Programming Guide at apple.com is a great reference. Also Ray Wenderlich's CALayer Tutorial and UIView Animation are nicely done.

UITouch events and UIGestureRecognizer subclasses were covered in detail.

Homework 6: Animation
  • Create a basic game with tiles, each tile having a letter
  • Letters make up a word that is scrambled across the tiles at random positions on the screen
  • The user will drag the tiles into squares at the bottom of the screen
  • If the user correctly spells the word, display a modal UIViewController congratulating them
  • When the dialog is dismissed, and word is chosen, and the tiles animate into random positions on the screen

Lecture 5 - Custom View Drawing - 2/6/2013

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 apple.com 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 - Controllers of UIViewControllers - 1/30/2013

In this lecture, we look mainly at the UITabBarController and UINavigationController.


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. In ViewDidLoad, Implement 3 UIViewControllers and add them to a UITabBarController. Place the UITabBarController.view onto the screen.
  • 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 - Collection Classes (NSArray, NSDictionary), UITableView, Delegation Introduction - 1/23/2013

In this lecture, we review two Cocoa classes that hold a collection of objects: NSArray and NSDictionary.

The UITableView specialized view is demonstrated, and the concept of delegation is introduced in the context of the UITableView.


Homework 3: UITableView
  • Create an iphone application using the view-based template
  • Create an ivar in the view controller of type NSArray holding at least three NSDictionary objects
  • Add a UITableView to the screen to display the list of objects

Lecture 2 - More Objective-C, Specialized UIView Objects, Target/Action - 1/16/2013

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 classes, and define a class with the @interface and @implementation keywords.

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 you 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 set 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/9/2013

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 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 extensions that are discussed and should be reviewed:
  • @interface
  • @class
  • @property
  • [ ] (square brackets)
  • #import
  • - (minus sign to mark an instance method)
  • + (plus sign to mark an class method)


Homework 1: Contact Info, Setting Up Your Development Environment, Basic App
  • Send an email to Dave at dhenson@certifiednetworks.com with iOS in the subject line. This is important so your email address can be whitelisted.
  • Read 'Learning Objective-C: A Primer' from Apple. Apple Documentation - Objective-C, A Primer
  • Install the current production version of XCode - Version 4.5.2. 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. See Homework1.zip for a completed solution to the homework assignment.


Video: Homework 1 answer
Back to Top

XCode Projects - Class Demos, Examples and Homework Answers

Slides

Class Logistics

Previous Versions of iPhone and iPad iOS Development class

External Links

home Site Map Terms of Use Privacy Policy Client Directories