Programming iOS - Developing Applications for iPhone and iPad

7/9/2014 - 9/17/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 Shopzilla.com, LiveNation/TicketMaster, and many other smaller companies and individuals.



Lecture 9 - Debugging and Performance Monitoring, Integrating Video and HTML5 into your application - 9/10/2014

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.

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.

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


Homework 9: 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
  • Bonus extra credit: encode your video into an HLS stream, and deliver it from an S3 bucket.


Lecture 8 - Network connections with sockets and GameKit - 9/3/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:

ArduinoClient3.zip - uses CocoaAsyncSockect to send a UDP packet to an Arduino
UDPSendReceiveString.ino.zip - Arduino socket server example
UDPSendReceiveString.zip - iPhone app client of a node.js server
socketServerWithFeedback.js.zip - node.js source for a simple socket server
webserver.js.zip - node.js source for a simple web server


Homework 8: Network Sockets

.

Complete at least one of the following exercises. I recommend using CocoaAsyncSocket on the iOS side to simplify using the sockets API.
  • Write an iphone application that communicates through a socket to a program 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 to communicate with an iPhone app over Sockets
  • Write a sockets server in Ruby (pre installed on Mac OsX) and communicate with an iPhone application


Lecture 7 - Internet Resources continued - 8/27/2014

In this lecture we continue to look at making server connections with NSURL, NSURLRequest and NSURLConnection. Grand Central Dispatch (GCD) and the "blocks" Objective-C language feature will be discussed.

In class we will build a reusable component to asynchronously download data from the Internet.

We will investigate techniques to monitor and view Internet traffic.

You may want to check out`the open source AFNetworking framework which is very popular. It wraps up making internet calls such as posting to an API, making common tasks such as this easier.

Homework 7: Parsing a document from a web server
  • Add a UICollectionViewController to an ipad application
  • Implement the delegate protocol to support the UICollectionViewController
  • Load a collage of UIImageView objects to the UICollectionView
  • Download a number of G-rated images into the UIImageViews asynchronously
  • For extra credit, fade the images in as they are downloaded


Lecture 6 - Files, Internet Resources and cloud technologies - 8/20/2014

A common requirement for applications is to work with files. These files can be stored locally on the device, but often are downloaded from webservers.

The content and structure of downloaded data might be the HTML for web pages, but could also be data in the form of JSON, XML, or any other arbitray format as needed.

In this lecture, an AWS server instance is created from scratch and Apache, MySql and PHP installed. A simplistic JSON data feed is setup to deliver data from the MySql database to an iphone app in the following format:

[{"StudentID":"1","StudentEmail":"joe@nowhere.com"},{"StudentID":"2","StudentEmail":"sally@nowhere.com"},{"StudentID":"3","StudentEmail":"kim@fmail.com"}]


See jsonservice.php.zip below for the php code.

Along the way, we look at storing files in the "Documents" directory and parsing JSON files.

Homework 7: Parsing a document from a web server
  • Add a UITableView to an iphone application
  • Download the JSON document from our class AWS Server or another location that you set up
  • Parse the JSON into an NSArray of NSDictionary objects
  • Load the NSDictionary objects into an array of class objects
  • Use the array as a datasource for the UITableView


Lecture 5 - Custom UIView Drawing, Animation Introduction - 8/13/2014

In this lecture we cover custom UIView Drawing.

Apple has provided many specialized UIView-based objects such as UIWebView and UITableView. In this lecture, we investigate creating your own reusable specialized view.

We also investigate the basics of animation on the iOS platform as provided by the CALayer class.

Homework 5: Custom UIView Drawing
In this lab, you will investigate using the Quartz framework to draw custom UIView objects.
  • Create an ipad application using the "empty" template.
  • Implement a custom UIView that represents a single line on a bar graph. Draw the bar with an outline color and a slightly rounded top edge.
  • Implement a graph view that houses a collection of the bar graph views.
  • Implement a graph delegate protocol to support the graph view.
  • Place two bar graph viewcontrollers on the screen to demonstrate the properly functioning and re-usable view controller.
Any arbitrary constraints that are necessary can be placed on the view controller in the interest of time. For example, your graph might always support exactly 10 datapoints.


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

In this lecture, we will review delegation, UITableView and UIViewController. We then cover classes that act as containers of UIViewControllers: UINavigationController and UITabbarController.


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 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 g-rated image 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 - Foundation collection Classes, delegation introduction

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.

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:
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CocoaFundamentals/CommunicatingWithObjects/CommunicateWithObjects.html


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.



Lecture 2 - More Objective-C, Specialized UIView Objects, Target/Action - 7/16/2014

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 sets the .text property of the UILabel
  • Use target/action on the UIButton to call your method when the TouchUpInside event is fired

Video: Homework 2 - UIViews and Target/Action


Lecture 1 - iPhone/iPad Platform and Objective-C - 7/9/2014

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


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.
  • 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

Slides

Class Logistics

Previous Versions of iPhone and iPad iOS Development class

External Links

home Site Map Terms of Use Privacy Policy Client Directories