Developer Courses + Tutorials !

Unless you’ve been living under a rock, you know that the iPhone is a big deal and it’s one of the most popular subjects of development these days. Lots of developers are creating their own iPhone apps, and with the right know-how, you can too. Check out our list of courses and tutorials to learn everything that’s important about developing for the iPhone.

University
Here you’ll find iPhone development courses offered by top universities.
  1. iPhone Application Programming: Learn about programming for the iPhone from Stanford on iTunes. [Stanford]
  2. Introduction to iPhone Application Development: Use this course’s posted slides to get a crash course in iPhone application development. [MIT]
Apple Resources
You can learn about iPhone development straight from the source with these Apple documents.
  1. Getting Started with iPhone: Here you’ll find a general introduction to iPhone development. [Apple]
  2. Object-Oriented Programming with Objective-C: This document offers an excellent guide for object oriented programming. [Apple]
  3. Networking & Internet Coding How-Tos: In this resource, you will find lots of great advice for networking and Internet development on the iPhone. [Apple]
  4. Getting Started with Audio & Video: Use this document to get started with audio and video features in iPhone applications. [Apple]
  5. Your First iPhone Application: This introductory tutorial offers a step by step description of getting started with an iPhone application. [Apple]
  6. Getting Started with Performance: This guide offers an introduction to improving the performance on iPhone apps. [Apple]
  7. iPhone Application Programming Guide: Get an introduction to the iPhone OS and development process. [Apple]
  8. iPhone OS Technology Overview: Learn about the iPhone OS and its technologies from this guide. [Apple]
  9. Getting Started with Data Management: Here you’ll find a reference that will help you with data management. [Apple]
  10. Security Overview: Get an understanding of the security concepts on the iPhone from this resource. [Apple]
  11. Performance Overview: Get a look at the factors that determine performance through this guide. [Apple]
  12. Resource Programming Guide: Check out this resource to learn how to work with nib and bundle resources.
  13. Getting Started with User Experience: This document offers an introduction to constructing iPhone application user interfaces. [Apple]
  14. iPhone Human Interface Guidelines: Follow these guidelines to make sure your iPhone app has a good human interface. [Apple]
  15. iPhone Development Guide: Use this development guide to get an introduction to creating web apps on the iPhone. [Apple]
  16. Data Formatting Programming Guide for Cocoa: This guide will teach you how to use Cocoa formatters for data. [Apple]
  17. Getting Started with Tools: You will find a guided introduction to the Xcode toolset from this document. [Apple]
  18. Data Management Coding How-tos: Get answers to common data management coding questions. [Apple]
  19. Introduction to Cocoa Application Tutorial: You’ll need at least a base level understanding of Cocoa for iPhone development, which you can check out in this tutorial. [Apple]
  20. Core Animation Programming Guide: Follow this guide to get the main components and services of Core Animation. [Apple]
  21. Coding Guidelines for Cocoa: In this guide, you’ll learn about naming guidelines for the Cocoa API as well as design advice. [Apple]
  22. Getting Started with Graphics and Animation: Follow this guide for an introduction to 2D and 3D graphics and animation. [Apple]
  23. Learning Objective-C: A Primer: Check out this document once you’ve worked through object oriented programming and Cocoa. [Apple]
  24. Cocoa Fundamentals Guide: You’ll learn about the basic concepts, terminology, and more in Cocoa from this guide. [Apple]
  25. Graphics and Animation Coding How-Tos: In this resource, you’ll find lots of great tips and advice for graphics and animation on the iPhone. [Apple]
Getting Started
Get an introduction to iPhone development through these tutorials.
  1. iPhone App Development-Where to Start: This tutorial will teach you how to get started in iPhone app development. [The Daleisphere]
  2. Bootstrap: Learn a few pointers for iPhone development from this resource. [furbo]
  3. Learn How to Develop for the iPhone: This tutorial will show you how to build an alternate page and style sheet for the iPhone. [NETTUTS]
  4. iPhone Application Development, Step By Step: In this tutorial, you will find a step by step guide to creating a simple iPhone game. [Open Laszlo]
  5. First iPhone Application: Get a brief introduction to creating your first iPhone application. [iPhone SDK Articles]
  6. iPhone Dev: Check out this PDF to get a tutorial for iPhone development. [Lucas Newman]
  7. iPhone App Development for Web Hackers: Use this tutorial to learn about geo-location features and beginner development tips. [How to Iphone Application]
  8. How to Write an iPhone App: This tutorial gives you a basic look at what it takes to write an iPhone application. [Webmonkey]
  9. iPhone App Development for Web Hackers: In this article, you’ll learn about web hacking development for the iPhone. [Dominiek]
  10. Writing Your First iPhone Application: Bill Dudney will walk you through all of the tools and pieces of knowledge you’ll need to write your first iPhone application. [The Pragmatic Bookshelf]
  11. Cocoa Touch Tutorial: iPhone Application Example: This tutorial will show you how to make a very basic Cocoa Touch application with Interface Builder. [Cocoa Is My Girlfriend]
  12. Building an iPhone app in a day: Check out this tutorial to see how you can build a useful app quickly. [The Bakery]
  13. Seven Things All iPhone Apps Need: Check out this list to see what’s essential when creating an iPhone app. [APCmag]
  14. Put Your Content in My Pocket: Learn how to use the iPhone web browser to your advantage from this article. [A List Apart]
  15. iPhone Training Course: Become a master at writing iPhone applications through this course. [Rose India]
  16. So you’re going to write an iPhone app…: Learn about code reuse, memory, and more from this tutorial. [furbo]
  17. Learn How to Develop for the iPhone: Check out this tutorial to see how to build an alternative page and style sheet for the iPhone. [Net Tuts]
  18. Developing for the iPhone: This resource will show you how to develop ASP.NET applications for the iPhone. [Dot Net Slackers]
  19. Getting Started with iPhone Development: Ed Burnette offers a basic introduction to iPhone development. [ZDnet]
Tools
These tutorials will teach you how to use specific tools in order to create iPhone apps.
  1. Make an iPhone App Using the Envato API: Make your own iPhone app with the Envato API with the help of this tutorial. [Net Tuts]
  2. Developing iPhone Applications using Ruby on Rails and Eclipse: Learn how to detect mobile Safari from a Ruby on Rails application through this tutorial. [IBM]
  3. 14 Essential Xcode Tips, Tricks and Resources for iPhone Devs: Learn how to make sense of xcode with this helpful resource. [Mobile Orchard]
  4. Develop iPhone Web Applications with Eclipse: This tutorial will help you learn how to create iPhone applications with Aptana’s iPhone development plug-in. [IMB]
  5. Build an iPhone Webapp in Minutes with Ruby, Sinatra, and iUI: You can learn how to quickly put together an iPhone app with these tools. [Mobile Orchard]
  6. iPhone Development with PHP and XML: In this tutorial, you’ll get a look at developing custom applications for the iPhone. [IBM]
Details
These tutorials cover all of the important details in iPhone app development.
  1. Avoiding iPhone App Rejection from Apple: This tutorial holds the secrets to making sure your iPhone app makes the cut. [Mobile Orchard]
  2. Landscape Tab Bar Application for the iPhone: Follow this tutorial to learn about making the tab bar application support landscape orientation. [Cocoa Is My Girlfriend]
  3. iPhone Programming Tutorial-Using openURL to Send Email from Your App: This tutorial explains how you can send email through applications, and even pre-fill fields. [iCode]
  4. Multi Touch Tutorial: This tutorial will show you how you can respond to a tap event. [iPhone SDK Articles]
  5. Create a Navigation-Based Application: This tutorial will teach you how to create and run a navigation-based application from XCode.
  6. Advanced iPhone Development: Go beyond the basics with this iPhone development tutorial. [Dot Net Slackers]
  7. Here’s a Quick Way to Deal with Dates in Objective C: Get information on dealing with date fetching through this tutorial. [Howtomakeiphoneapps]
  8. Navigation Controller + UIToolbar: Through this tutorial, you can learn how to add a UIToolbar to an app. [iPhone SDK Articles]
  9. iPhone Asynchonous Table Image: Follow this thorough article to learn about loading multiple images in your iPhone app in an asynchonous manner. [Markj]
  10. Localizing iPhone Apps-Internationalization: You can use resource files to display text in a user’s language-learn how in this tutorial. [iPhone SDK Articles]
  11. Tutorial: JSON Over HTTP on the iPhone: With this tutorial, you’ll get a step by step how-to for JSON web services through an iPhone app. [Mobile Orchard]
  12. Parsing xml on the iPhone: This tutorial will show you how to parse XML using the iPhone SDK. [Craig Giles]
  13. Reading data from a SQLite Database: Here you’ll find a quick tutorial for reading data from a SQLite database. [dBlog]
  14. How to Make an Orientation-Aware Clock: Through this tutorial, you’ll learn about building a simple, orientation-aware clock. [The Apple Blog]
  15. Finding iPhone Memory Leaks: Carefully find iPhone memory leaks by using this tutorial. [Mobile Orchard]
  16. Localizing iPhone Apps: MAke sure that your iPhone app is properly formatted according to a user’s native country or region with the help of this tutorial. [iPhone SDK Articles]
  17. OpenAL Audio Programming on iPhone: Here you’ll get code snippets, learning, and more. [Gehaktes]
  18. 9 iPhone Memory Management Links and Resources: Here you’ll find a variety of iPhone memory management resources that can help you get things under control. [Mobile Orchard]
  19. Parsing XML Files: Get an understanding of how you can parse XML files with this tutorial. [iPhone SDK Articles]
User Interface
These tutorials are all about the user interface and interaction.
  1. UITableView-Drill down table view tutorial: Check out this tutorial to learn how to make a drill down table view. [iPhone SDK Articles]
  2. iPhone Coding-Learning About UIWebViews by Creating a Web Browser: In this tutorial, you’ll learn about UIWebViews through the creation of a browser. [iCode]
  3. Design Patterns on the iPhone: Check out David Choi’s guest lecture on user interface design for the iPhone. [New Jersey Institute of Technology]
  4. UITableView-Adding subviews to a cell’s content view: This tutorial will show you how to customize the UITableViewCell. [iPhone SDK Articles]
  5. Drill down table view with a detail view: Learn how to load a different detail view on the UITabBarController. [iPhone SDK Articles]
  6. Extending the iPhone’s SDK’s UIColor Class: Learn how to extend the iPhone SDK UIColor class, and get code samples from this article. [Ars Technica]
  7. UITableView: Learn how to make a simple index for the table view with this tutorial. [iPhone SDK Articles]
Building Tutorials
Check out these tutorials where you’ll build a specific app, and learn more about iPhone development along the way.
  1. Build a Simple RSS Reader for the iPhone: Get walked through the creation of an RSS reader for a simple feed on the iPhone. [The Apple Blog]
  2. iPhone Gaming Framework: This article offers a look at writing code for iPhone game developers. [Craig Giles]
  3. Build a Simple RSS Reader for the iPhone: Follow this tutorial, and you’ll learn about building a simple iPhone RSS reader.
  4. iPhone Game Programming Tutorial: This multipart tutorial offers a way to learn OpenGL and Quartz for iPhone development. [iCode]
  5. Build your very own Web browser!: Follow this tutorial to learn about the process of building your own iPhone web browser. [dBlog]
  6. iPhone application development, step by step: Find out how to build the iPhone application NEWSMATCH using OpenLaszlo. [OpenLaszlo]
  7. Building an Advanced RSS Reader using TouchXML: Get step by step information for creating an advanced iPhone RSS reader from this tutorial. [DBlog]
  8. iPhone SDK Tutorial: Building an Advanced RSS Reader Using TouchXML: This tutorial will help you learn more about iPhone development by building an advanced RSS reader with TouchXML. [dBlog]
Videos
Watch these videos for a visual guide to iPhone app development.
  1. Basic iPhone Programming: Check out this video to get started with iPhone programming. [iPhone Dev Central]
  2. First Step Towards the App Store: Work towards getting your app in the app store with the help of this tutorial. [You Tube]
  3. Hello World: This tutorial will help you learn the basics of iPhone programming. [iPhone Dev Central]
  4. UITableView iPhone Programming Tutorial: Watch this video to learn how to populate a UITableView. [YouTube]
  5. iPhone App Tutorial 1: Check out this video to quickly learn about Interface Builder. [YouTube]
  6. iPhone IB-Your First App: Watch this tutorial to learn how to use the Interface Builder. [iPhone Dev Central]
  7. Understanding Source Code: Learn how to get started with development on the iPhone through this video tutorial. [YouTube]
  8. How to Make an iPhone App: Create an iPhone app using Jiggy and this tutorial. [YouTube]
  9. iPhone Development with Dashcode: Find out how to develop iPhone applications with Dashcode through this tutorial. [YouTube]
Development Resources
These resources are not courses or tutorials, but they are incredibly valuable resources for beginner iPhone app developers.
  1. iPhone Open Application Development: This book will teach you how to create software for the iPhone environment. [Safari Books Online]
  2. iPhone GUI PSD File: Use this set to get a comprehensive, editable library of iPhone UI assets. [Teehanlax]
  3. 31 iPhone Applications with Source Code: Teach yourself how to create iPhone apps by taking a look at the code in these. [Mobile Orchard]
  4. iPhoney: Using iPhoney, you’ll be able to see how your creation will look on the iPhone. [Market Circle]
  5. 35 Free iPhone Icon Sets: Check out this resource to find a great variety of iPhone icons.

Developer Courses + Tutorials !

Unless you’ve been living under a rock, you know that the iPhone is a big deal and it’s one of the most popular subjects of development these days. Lots of developers are creating their own iPhone apps, and with the right know-how, you can too. Check out our list of courses and tutorials to learn everything that’s important about developing for the iPhone.

University
Here you’ll find iPhone development courses offered by top universities.
  1. iPhone Application Programming: Learn about programming for the iPhone from Stanford on iTunes. [Stanford]
  2. Introduction to iPhone Application Development: Use this course’s posted slides to get a crash course in iPhone application development. [MIT]
Apple Resources
You can learn about iPhone development straight from the source with these Apple documents.
  1. Getting Started with iPhone: Here you’ll find a general introduction to iPhone development. [Apple]
  2. Object-Oriented Programming with Objective-C: This document offers an excellent guide for object oriented programming. [Apple]
  3. Networking & Internet Coding How-Tos: In this resource, you will find lots of great advice for networking and Internet development on the iPhone. [Apple]
  4. Getting Started with Audio & Video: Use this document to get started with audio and video features in iPhone applications. [Apple]
  5. Your First iPhone Application: This introductory tutorial offers a step by step description of getting started with an iPhone application. [Apple]
  6. Getting Started with Performance: This guide offers an introduction to improving the performance on iPhone apps. [Apple]
  7. iPhone Application Programming Guide: Get an introduction to the iPhone OS and development process. [Apple]
  8. iPhone OS Technology Overview: Learn about the iPhone OS and its technologies from this guide. [Apple]
  9. Getting Started with Data Management: Here you’ll find a reference that will help you with data management. [Apple]
  10. Security Overview: Get an understanding of the security concepts on the iPhone from this resource. [Apple]
  11. Performance Overview: Get a look at the factors that determine performance through this guide. [Apple]
  12. Resource Programming Guide: Check out this resource to learn how to work with nib and bundle resources.
  13. Getting Started with User Experience: This document offers an introduction to constructing iPhone application user interfaces. [Apple]
  14. iPhone Human Interface Guidelines: Follow these guidelines to make sure your iPhone app has a good human interface. [Apple]
  15. iPhone Development Guide: Use this development guide to get an introduction to creating web apps on the iPhone. [Apple]
  16. Data Formatting Programming Guide for Cocoa: This guide will teach you how to use Cocoa formatters for data. [Apple]
  17. Getting Started with Tools: You will find a guided introduction to the Xcode toolset from this document. [Apple]
  18. Data Management Coding How-tos: Get answers to common data management coding questions. [Apple]
  19. Introduction to Cocoa Application Tutorial: You’ll need at least a base level understanding of Cocoa for iPhone development, which you can check out in this tutorial. [Apple]
  20. Core Animation Programming Guide: Follow this guide to get the main components and services of Core Animation. [Apple]
  21. Coding Guidelines for Cocoa: In this guide, you’ll learn about naming guidelines for the Cocoa API as well as design advice. [Apple]
  22. Getting Started with Graphics and Animation: Follow this guide for an introduction to 2D and 3D graphics and animation. [Apple]
  23. Learning Objective-C: A Primer: Check out this document once you’ve worked through object oriented programming and Cocoa. [Apple]
  24. Cocoa Fundamentals Guide: You’ll learn about the basic concepts, terminology, and more in Cocoa from this guide. [Apple]
  25. Graphics and Animation Coding How-Tos: In this resource, you’ll find lots of great tips and advice for graphics and animation on the iPhone. [Apple]
Getting Started
Get an introduction to iPhone development through these tutorials.
  1. iPhone App Development-Where to Start: This tutorial will teach you how to get started in iPhone app development. [The Daleisphere]
  2. Bootstrap: Learn a few pointers for iPhone development from this resource. [furbo]
  3. Learn How to Develop for the iPhone: This tutorial will show you how to build an alternate page and style sheet for the iPhone. [NETTUTS]
  4. iPhone Application Development, Step By Step: In this tutorial, you will find a step by step guide to creating a simple iPhone game. [Open Laszlo]
  5. First iPhone Application: Get a brief introduction to creating your first iPhone application. [iPhone SDK Articles]
  6. iPhone Dev: Check out this PDF to get a tutorial for iPhone development. [Lucas Newman]
  7. iPhone App Development for Web Hackers: Use this tutorial to learn about geo-location features and beginner development tips. [How to Iphone Application]
  8. How to Write an iPhone App: This tutorial gives you a basic look at what it takes to write an iPhone application. [Webmonkey]
  9. iPhone App Development for Web Hackers: In this article, you’ll learn about web hacking development for the iPhone. [Dominiek]
  10. Writing Your First iPhone Application: Bill Dudney will walk you through all of the tools and pieces of knowledge you’ll need to write your first iPhone application. [The Pragmatic Bookshelf]
  11. Cocoa Touch Tutorial: iPhone Application Example: This tutorial will show you how to make a very basic Cocoa Touch application with Interface Builder. [Cocoa Is My Girlfriend]
  12. Building an iPhone app in a day: Check out this tutorial to see how you can build a useful app quickly. [The Bakery]
  13. Seven Things All iPhone Apps Need: Check out this list to see what’s essential when creating an iPhone app. [APCmag]
  14. Put Your Content in My Pocket: Learn how to use the iPhone web browser to your advantage from this article. [A List Apart]
  15. iPhone Training Course: Become a master at writing iPhone applications through this course. [Rose India]
  16. So you’re going to write an iPhone app…: Learn about code reuse, memory, and more from this tutorial. [furbo]
  17. Learn How to Develop for the iPhone: Check out this tutorial to see how to build an alternative page and style sheet for the iPhone. [Net Tuts]
  18. Developing for the iPhone: This resource will show you how to develop ASP.NET applications for the iPhone. [Dot Net Slackers]
  19. Getting Started with iPhone Development: Ed Burnette offers a basic introduction to iPhone development. [ZDnet]
Tools
These tutorials will teach you how to use specific tools in order to create iPhone apps.
  1. Make an iPhone App Using the Envato API: Make your own iPhone app with the Envato API with the help of this tutorial. [Net Tuts]
  2. Developing iPhone Applications using Ruby on Rails and Eclipse: Learn how to detect mobile Safari from a Ruby on Rails application through this tutorial. [IBM]
  3. 14 Essential Xcode Tips, Tricks and Resources for iPhone Devs: Learn how to make sense of xcode with this helpful resource. [Mobile Orchard]
  4. Develop iPhone Web Applications with Eclipse: This tutorial will help you learn how to create iPhone applications with Aptana’s iPhone development plug-in. [IMB]
  5. Build an iPhone Webapp in Minutes with Ruby, Sinatra, and iUI: You can learn how to quickly put together an iPhone app with these tools. [Mobile Orchard]
  6. iPhone Development with PHP and XML: In this tutorial, you’ll get a look at developing custom applications for the iPhone. [IBM]
Details
These tutorials cover all of the important details in iPhone app development.
  1. Avoiding iPhone App Rejection from Apple: This tutorial holds the secrets to making sure your iPhone app makes the cut. [Mobile Orchard]
  2. Landscape Tab Bar Application for the iPhone: Follow this tutorial to learn about making the tab bar application support landscape orientation. [Cocoa Is My Girlfriend]
  3. iPhone Programming Tutorial-Using openURL to Send Email from Your App: This tutorial explains how you can send email through applications, and even pre-fill fields. [iCode]
  4. Multi Touch Tutorial: This tutorial will show you how you can respond to a tap event. [iPhone SDK Articles]
  5. Create a Navigation-Based Application: This tutorial will teach you how to create and run a navigation-based application from XCode.
  6. Advanced iPhone Development: Go beyond the basics with this iPhone development tutorial. [Dot Net Slackers]
  7. Here’s a Quick Way to Deal with Dates in Objective C: Get information on dealing with date fetching through this tutorial. [Howtomakeiphoneapps]
  8. Navigation Controller + UIToolbar: Through this tutorial, you can learn how to add a UIToolbar to an app. [iPhone SDK Articles]
  9. iPhone Asynchonous Table Image: Follow this thorough article to learn about loading multiple images in your iPhone app in an asynchonous manner. [Markj]
  10. Localizing iPhone Apps-Internationalization: You can use resource files to display text in a user’s language-learn how in this tutorial. [iPhone SDK Articles]
  11. Tutorial: JSON Over HTTP on the iPhone: With this tutorial, you’ll get a step by step how-to for JSON web services through an iPhone app. [Mobile Orchard]
  12. Parsing xml on the iPhone: This tutorial will show you how to parse XML using the iPhone SDK. [Craig Giles]
  13. Reading data from a SQLite Database: Here you’ll find a quick tutorial for reading data from a SQLite database. [dBlog]
  14. How to Make an Orientation-Aware Clock: Through this tutorial, you’ll learn about building a simple, orientation-aware clock. [The Apple Blog]
  15. Finding iPhone Memory Leaks: Carefully find iPhone memory leaks by using this tutorial. [Mobile Orchard]
  16. Localizing iPhone Apps: MAke sure that your iPhone app is properly formatted according to a user’s native country or region with the help of this tutorial. [iPhone SDK Articles]
  17. OpenAL Audio Programming on iPhone: Here you’ll get code snippets, learning, and more. [Gehaktes]
  18. 9 iPhone Memory Management Links and Resources: Here you’ll find a variety of iPhone memory management resources that can help you get things under control. [Mobile Orchard]
  19. Parsing XML Files: Get an understanding of how you can parse XML files with this tutorial. [iPhone SDK Articles]
User Interface
These tutorials are all about the user interface and interaction.
  1. UITableView-Drill down table view tutorial: Check out this tutorial to learn how to make a drill down table view. [iPhone SDK Articles]
  2. iPhone Coding-Learning About UIWebViews by Creating a Web Browser: In this tutorial, you’ll learn about UIWebViews through the creation of a browser. [iCode]
  3. Design Patterns on the iPhone: Check out David Choi’s guest lecture on user interface design for the iPhone. [New Jersey Institute of Technology]
  4. UITableView-Adding subviews to a cell’s content view: This tutorial will show you how to customize the UITableViewCell. [iPhone SDK Articles]
  5. Drill down table view with a detail view: Learn how to load a different detail view on the UITabBarController. [iPhone SDK Articles]
  6. Extending the iPhone’s SDK’s UIColor Class: Learn how to extend the iPhone SDK UIColor class, and get code samples from this article. [Ars Technica]
  7. UITableView: Learn how to make a simple index for the table view with this tutorial. [iPhone SDK Articles]
Building Tutorials
Check out these tutorials where you’ll build a specific app, and learn more about iPhone development along the way.
  1. Build a Simple RSS Reader for the iPhone: Get walked through the creation of an RSS reader for a simple feed on the iPhone. [The Apple Blog]
  2. iPhone Gaming Framework: This article offers a look at writing code for iPhone game developers. [Craig Giles]
  3. Build a Simple RSS Reader for the iPhone: Follow this tutorial, and you’ll learn about building a simple iPhone RSS reader.
  4. iPhone Game Programming Tutorial: This multipart tutorial offers a way to learn OpenGL and Quartz for iPhone development. [iCode]
  5. Build your very own Web browser!: Follow this tutorial to learn about the process of building your own iPhone web browser. [dBlog]
  6. iPhone application development, step by step: Find out how to build the iPhone application NEWSMATCH using OpenLaszlo. [OpenLaszlo]
  7. Building an Advanced RSS Reader using TouchXML: Get step by step information for creating an advanced iPhone RSS reader from this tutorial. [DBlog]
  8. iPhone SDK Tutorial: Building an Advanced RSS Reader Using TouchXML: This tutorial will help you learn more about iPhone development by building an advanced RSS reader with TouchXML. [dBlog]
Videos
Watch these videos for a visual guide to iPhone app development.
  1. Basic iPhone Programming: Check out this video to get started with iPhone programming. [iPhone Dev Central]
  2. First Step Towards the App Store: Work towards getting your app in the app store with the help of this tutorial. [You Tube]
  3. Hello World: This tutorial will help you learn the basics of iPhone programming. [iPhone Dev Central]
  4. UITableView iPhone Programming Tutorial: Watch this video to learn how to populate a UITableView. [YouTube]
  5. iPhone App Tutorial 1: Check out this video to quickly learn about Interface Builder. [YouTube]
  6. iPhone IB-Your First App: Watch this tutorial to learn how to use the Interface Builder. [iPhone Dev Central]
  7. Understanding Source Code: Learn how to get started with development on the iPhone through this video tutorial. [YouTube]
  8. How to Make an iPhone App: Create an iPhone app using Jiggy and this tutorial. [YouTube]
  9. iPhone Development with Dashcode: Find out how to develop iPhone applications with Dashcode through this tutorial. [YouTube]
Development Resources
These resources are not courses or tutorials, but they are incredibly valuable resources for beginner iPhone app developers.
  1. iPhone Open Application Development: This book will teach you how to create software for the iPhone environment. [Safari Books Online]
  2. iPhone GUI PSD File: Use this set to get a comprehensive, editable library of iPhone UI assets. [Teehanlax]
  3. 31 iPhone Applications with Source Code: Teach yourself how to create iPhone apps by taking a look at the code in these. [Mobile Orchard]
  4. iPhoney: Using iPhoney, you’ll be able to see how your creation will look on the iPhone. [Market Circle]
  5. 35 Free iPhone Icon Sets: Check out this resource to find a great variety of iPhone icons.

Dashboard Widget Tutorial

This tutorial walks you through using Dashcode to create a Dashboard widget. As you follow the steps, you learn how to choose a widget template, customize your widget’s appearance and code, and share your widget with others. Completing this tutorial is a quick and easy way to get started building Dashboard widgets in Dashcode.

This document includes two additional tutorials, “Mobile Safari Web Application Tutorial” and “Dual-Product Web Application Tutorial,” which follow this one. The remainder of the document delves more deeply into the Dashcode development environment, describing how it supports both widget and web application development. If you don’t want to learn how to create a web application, you can continue learning more about Dashcode by reading “Starting a Project.”

Before You Begin !

In this tutorial, you build a Dashboard widget that counts down to your birthday, similar to the widget shown in Figure 1-1.

Figure 1-1  The Birthday widget



Before continuing, make sure that you have Dashcode installed on your Mac (the location is /Developer/Applications/). If you don’t have Dashcode installed, read “Getting and Running Dashcode” to learn how to get and install Dashcode.


Choose a Template


To start, double-click the Dashcode icon to open it. A new project window opens and displays a dialog in which you first select the type of project you’re interested in—in this case, Dashboard—and then, the kind of widget you want to create from an assortment of templates. Templates are handy starting points for creating common types of widgets. Select a template’s icon to show a short description of what that template does.

To make the Birthday widget, this tutorial uses the Countdown template. Select its icon and click Choose. A project window opens with a new widget based on the Countdown template, as shown in Figure 1-2.

Figure 1-2  A project window showing a new Dashboard widget


Along the left side of the project window is the navigator, which you use to switch between the various tools available when you’re designing a widget. The main portion of the window is the canvas, which you use to design your widget’s interface.

At the bottom of the navigator in Figure 1-2 you can see the Workflow Steps list, which guides you through the widget development process. Each step is a milestone in creating a widget, telling you what to do and where to do it. When you complete a step, mark it as done and move on to the next step.

Note: If you don’t want to see the Workflow Steps list, you can hide it by choosing View > Steps or by clicking the button that looks like a checkbox at the bottom edge of the project window (this button is highlighted in Figure 1-2).
Alternatively, you can view a list of the widget’s files in place of the Workflow Steps list. If you want to see the Files list, choose View > Files or click the list button in the bottom edge of the project window (it’s the button that looks like a bulleted list).
Set the Target Date

The Countdown template gives you a Dashboard widget with all the elements and code needed to count down to an event. All you need to do is tell the widget the target date. To set the target date, select Widget Attributes in the navigator. The canvas is replaced by the widget attributes pane, in which you specify important values that your widget needs.

In the Properties section of the widget attributes pane, choose Date and Time in the Target Kind pop-up menu and enter the date of your next birthday, as shown in Figure 1-3.

Figure 1-3  The Countdown template’s properties





Test the Countdown

Your new Dashboard widget is already fully functional. To prove this, choose Debug > Run to run the widget. Dashcode can run a widget without opening it in Dashboard, making it a handy place to test your widget and fix any problems you encounter. After the widget loads, it starts counting down towards your next birthday.

When you’re satisfied that your widget is working as you expect, choose Debug > Stop to stop it.

Now is a good time to save your widget project. Choose File > Save to save the project. Give your project a name and select a location to save it in. Your widget is saved in a widget project that encapsulates the widget and information Dashcode needs to create the widget for you.


Customize the Widget’s Appearance

Although you now have a fully functioning Dashboard widget that’s ready to share, you might want to personalize it to make it unique. Dashcode’s design tools make it easy to customize your widget’s interface. Select the widget item in the navigator (it should display the name you gave it when you saved the project). The widget attributes pane is replaced with the canvas.

First, change your widget’s body color. Select the widget body (also called the front image or frontImg) on the canvas and then choose Window > Show Inspector. The inspector window allows you to modify a selected element’s properties, such as its appearance and behavior. Click the Fill & Stroke button at the top of the inspector window (it’s the second from the left). If it’s not already selected, click the Style tab to reveal fill, stroke, corner roundness, and opacity values. Click the color well and choose a new color in the Colors window that appears. Try different fill styles until you find a combination that you like. If you want to try changing other effects, such as the glass appearance, click the Effects tab to reveal these values, as shown in Figure 1-4.

Figure 1-4  Tweaking the front image using the Fill & Stroke inspector



When you’re finished customizing your widget’s body, add a photo of yourself from iPhoto to the widget. Your iPhoto library is available from the Library window. To show your iPhoto library, choose Window > Show Library; then click the Photos button. Find a photo and drag it to your widget on the canvas. Resize it by dragging any of the resize handles on the photo.

Finally, change the Event Label text to something like “...days until my birthday.“ You can do this by selecting the Event Label text, clicking the Attributes button in the inspector window (it’s the leftmost button), and entering the text in the Value field, or by double-clicking the text in the widget body itself and entering the new text.



Add Functionality Using Parts

Now that you have a personalized Dashboard widget that counts down to your birthday, add a button that, when clicked, shows the Apple Store (so your friends and family can buy you a birthday present!). To add a button to your widget, use a button part. Parts are controls and views used on a widget’s interface.

To find a button part, choose Window > Show Library and click Parts. You can use the search field at the bottom of the window to help you find a particular part or type of part. From the list of parts, drag the Lozenge Button part from the Library window to your widget’s body. Double-click the button to select its label text, enter the text “Buy me a gift” and press Return. You'll probably need to resize the button to fit the new label.



Write Code to Show the Apple Store

To make the button take the user to the Apple Store when it’s clicked, you need to add a behavior to the button. In the inspector window, click the Behaviors button (it’s the rightmost button). This shows the Behaviors pane, in which you assign handler functions to events on an object. Select the button on the canvas and double-click in the Handlers column next to the onclick event name. Enter the name of a new function, such as showAppleStore, and press Return. Click the arrow next to the function name you entered to reveal the source code editor below the canvas. Here you write code to add functionality to your widget. Clicking the arrow reveals the showAppleStore function Dashcode inserted in your widget’s code. Between the braces ({ .. }) enter the following line of code:

widget.openURL("http://store.apple.com/");


The code in the source code editor should look like that in Figure 1-5.



Figure 1-5  A function in the source code editor



Test your widget again by choosing Debug > Run. Click the button you added and make sure a new Safari window opens with the Apple Store website displayed. Be sure you save your project often to preserve the changes you make.




Deploy Your Widget

Congratulations! You’ve created your first complete Dashboard widget using Dashcode.

To open your widget in Dashboard, choose File > Deploy Widget. Click Install in the dialog that appears to view your widget in Dashboard.

To share your widget with the world, select Run & Share in the navigator. The pane that appears displays the widget project name you chose in “Test the Countdown,” but you can replace this with a different name if you want. You can also set the minimum version of Mac OS X your widget should run in. Click Save to Disk to save your widget. You can now email it to friends or post it on your webpage. You can use the File > Compress command in the Finder to archive it.

Dashboard Widget Tutorial

This tutorial walks you through using Dashcode to create a Dashboard widget. As you follow the steps, you learn how to choose a widget template, customize your widget’s appearance and code, and share your widget with others. Completing this tutorial is a quick and easy way to get started building Dashboard widgets in Dashcode.

This document includes two additional tutorials, “Mobile Safari Web Application Tutorial” and “Dual-Product Web Application Tutorial,” which follow this one. The remainder of the document delves more deeply into the Dashcode development environment, describing how it supports both widget and web application development. If you don’t want to learn how to create a web application, you can continue learning more about Dashcode by reading “Starting a Project.”

Before You Begin !

In this tutorial, you build a Dashboard widget that counts down to your birthday, similar to the widget shown in Figure 1-1.

Figure 1-1  The Birthday widget



Before continuing, make sure that you have Dashcode installed on your Mac (the location is /Developer/Applications/). If you don’t have Dashcode installed, read “Getting and Running Dashcode” to learn how to get and install Dashcode.


Choose a Template


To start, double-click the Dashcode icon to open it. A new project window opens and displays a dialog in which you first select the type of project you’re interested in—in this case, Dashboard—and then, the kind of widget you want to create from an assortment of templates. Templates are handy starting points for creating common types of widgets. Select a template’s icon to show a short description of what that template does.

To make the Birthday widget, this tutorial uses the Countdown template. Select its icon and click Choose. A project window opens with a new widget based on the Countdown template, as shown in Figure 1-2.

Figure 1-2  A project window showing a new Dashboard widget


Along the left side of the project window is the navigator, which you use to switch between the various tools available when you’re designing a widget. The main portion of the window is the canvas, which you use to design your widget’s interface.

At the bottom of the navigator in Figure 1-2 you can see the Workflow Steps list, which guides you through the widget development process. Each step is a milestone in creating a widget, telling you what to do and where to do it. When you complete a step, mark it as done and move on to the next step.

Note: If you don’t want to see the Workflow Steps list, you can hide it by choosing View > Steps or by clicking the button that looks like a checkbox at the bottom edge of the project window (this button is highlighted in Figure 1-2).
Alternatively, you can view a list of the widget’s files in place of the Workflow Steps list. If you want to see the Files list, choose View > Files or click the list button in the bottom edge of the project window (it’s the button that looks like a bulleted list).
Set the Target Date

The Countdown template gives you a Dashboard widget with all the elements and code needed to count down to an event. All you need to do is tell the widget the target date. To set the target date, select Widget Attributes in the navigator. The canvas is replaced by the widget attributes pane, in which you specify important values that your widget needs.

In the Properties section of the widget attributes pane, choose Date and Time in the Target Kind pop-up menu and enter the date of your next birthday, as shown in Figure 1-3.

Figure 1-3  The Countdown template’s properties





Test the Countdown

Your new Dashboard widget is already fully functional. To prove this, choose Debug > Run to run the widget. Dashcode can run a widget without opening it in Dashboard, making it a handy place to test your widget and fix any problems you encounter. After the widget loads, it starts counting down towards your next birthday.

When you’re satisfied that your widget is working as you expect, choose Debug > Stop to stop it.

Now is a good time to save your widget project. Choose File > Save to save the project. Give your project a name and select a location to save it in. Your widget is saved in a widget project that encapsulates the widget and information Dashcode needs to create the widget for you.


Customize the Widget’s Appearance

Although you now have a fully functioning Dashboard widget that’s ready to share, you might want to personalize it to make it unique. Dashcode’s design tools make it easy to customize your widget’s interface. Select the widget item in the navigator (it should display the name you gave it when you saved the project). The widget attributes pane is replaced with the canvas.

First, change your widget’s body color. Select the widget body (also called the front image or frontImg) on the canvas and then choose Window > Show Inspector. The inspector window allows you to modify a selected element’s properties, such as its appearance and behavior. Click the Fill & Stroke button at the top of the inspector window (it’s the second from the left). If it’s not already selected, click the Style tab to reveal fill, stroke, corner roundness, and opacity values. Click the color well and choose a new color in the Colors window that appears. Try different fill styles until you find a combination that you like. If you want to try changing other effects, such as the glass appearance, click the Effects tab to reveal these values, as shown in Figure 1-4.

Figure 1-4  Tweaking the front image using the Fill & Stroke inspector



When you’re finished customizing your widget’s body, add a photo of yourself from iPhoto to the widget. Your iPhoto library is available from the Library window. To show your iPhoto library, choose Window > Show Library; then click the Photos button. Find a photo and drag it to your widget on the canvas. Resize it by dragging any of the resize handles on the photo.

Finally, change the Event Label text to something like “...days until my birthday.“ You can do this by selecting the Event Label text, clicking the Attributes button in the inspector window (it’s the leftmost button), and entering the text in the Value field, or by double-clicking the text in the widget body itself and entering the new text.



Add Functionality Using Parts

Now that you have a personalized Dashboard widget that counts down to your birthday, add a button that, when clicked, shows the Apple Store (so your friends and family can buy you a birthday present!). To add a button to your widget, use a button part. Parts are controls and views used on a widget’s interface.

To find a button part, choose Window > Show Library and click Parts. You can use the search field at the bottom of the window to help you find a particular part or type of part. From the list of parts, drag the Lozenge Button part from the Library window to your widget’s body. Double-click the button to select its label text, enter the text “Buy me a gift” and press Return. You'll probably need to resize the button to fit the new label.



Write Code to Show the Apple Store

To make the button take the user to the Apple Store when it’s clicked, you need to add a behavior to the button. In the inspector window, click the Behaviors button (it’s the rightmost button). This shows the Behaviors pane, in which you assign handler functions to events on an object. Select the button on the canvas and double-click in the Handlers column next to the onclick event name. Enter the name of a new function, such as showAppleStore, and press Return. Click the arrow next to the function name you entered to reveal the source code editor below the canvas. Here you write code to add functionality to your widget. Clicking the arrow reveals the showAppleStore function Dashcode inserted in your widget’s code. Between the braces ({ .. }) enter the following line of code:

widget.openURL("http://store.apple.com/");


The code in the source code editor should look like that in Figure 1-5.



Figure 1-5  A function in the source code editor



Test your widget again by choosing Debug > Run. Click the button you added and make sure a new Safari window opens with the Apple Store website displayed. Be sure you save your project often to preserve the changes you make.




Deploy Your Widget

Congratulations! You’ve created your first complete Dashboard widget using Dashcode.

To open your widget in Dashboard, choose File > Deploy Widget. Click Install in the dialog that appears to view your widget in Dashboard.

To share your widget with the world, select Run & Share in the navigator. The pane that appears displays the widget project name you chose in “Test the Countdown,” but you can replace this with a different name if you want. You can also set the minimum version of Mac OS X your widget should run in. Click Save to Disk to save your widget. You can now email it to friends or post it on your webpage. You can use the File > Compress command in the Finder to archive it.

Developer Forum

Developer Forum

iOS Developer News

iOS Developer News

RSS Feed Reader Widget !

RSS Feed Reader Widget !

Build Web Apps with Dashcode !

When you first launch Dashcode (the easiest way to launch it is through Spotlight), you will see that Dashcode has already created some templates for you to build your Web applications quickly (see Figure 1).


Figure 1: The various templates provided by Dashcode

The best way to learn is to select each template (other than the Custom template) and examine the content of each application. When you have selected a template, examine their contents and press Command-r to test the application on the iPhone Simulator. Go ahead and have fun with each template. When you have enough fun and get yourself acquainted with the environment, come back and we shall create an iPhone Web application from scratch and you will see how each part is built.



Building the UI
Alright, now that you are back, create a new Custom project In Dashcode. Notice that by default, Dashcode created a content and a footer parts for you (see Figure 2). Parts are the various views that you seen on your Web applications, such as buttons, text, etc. For this section, you will create a simple currency convertor Web application for the iPhone.


Figure 2: The parts in the Custom template

Select each of these parts and press the delete key. We shall delete these two parts and add our own parts manually.

Using the Library (Window'Show Library), drag-and-drop a Stack Layout part to the design surface (see Figure 3).


Figure 3: Using the Library to drag and drop parts onto your application

Expand the stackLayout part and you should see that it contains two subviews - view1 and view2. Select view1 and change its size to 320px by 356px (see Figure 4) via the Inspector window (Window'Show Inspector). Do the same for view2.


Figure 4: Changing the size for view1 and view2 via the Inspector window

Double-click on view1 and rename it as mainScreen. Do the same for view2 and rename it as settings (see Figure 5).

Figure 5: Renaming the two subviews

In the Library, drag-and-drop the Rounded Rectangle Shape part onto the mainScreen view (see Figure 6).


Figure 6: Adding the Rounded Rectangle Shape part to the subview

It its Inspector window, select the Fill & Stroke tab and in the Style tab select Gradient fill (see Figure 7) and select two colors.


Figure 7: Using the gradient fill to fill the part

Select the Effects tab and check the Glass and Recess checkboxes (see Figure 8).


Figure 8: Adding glass effect to the part

Select the Metrics tab and select the Absolute layout (see Figure 9).


Figure 9: Using absolute layout for parts positioning



Add the following parts to the Rounded Rectangle Shape part (see Figure 10) and name them as:

Text
TextField
Pop-up Menu
Push Button



    Figure 10: Adding additional parts to the subview

    Select the settings subview and repeat the same steps you have performed above. Figure 11 shows the parts added to the settings subview.


    Figure 11: Populating the settings subview

    You are now ready to view the application on the iPhone Simulator. Press Command-r to view the application on the iPhone Simulator (see Figure 12). Notice that the application is hosted by mobile Safari on the iPhone.

    Figure 12: Click 'Run' toView the application on the iPhone Simulator

    Notice that you can only see the mainScreen subview. To see the settings subview, you need to write some code to navigate to it from the mainScreen subview.




    Coding the Application
    So you are now ready to write some code. With the mainScreen subview selected, right-click on the Settings button and select Events'onclick (see Figure 13).


    Figure 13: Creating an event handler for the onclick event

    You will be asked to name the event handler for this event. Name it as shown in Figure 14.


    Figure 14: Naming the handler for the event

    Notice that the code editor now appears at the bottom of the designer (see Figure 15).


    Figure 15: The code editor where you can add your code


    Enter the following code:

        function btnSettings_ClickHandler(event)
        {
            var views = document.getElementById('stackLayout');
            var settings = document.getElementById('settings');
            if (views && views.object && settings) {
                views.object.setCurrentView(settings);
            }
        }


    Select the settings subview and right-click on the Save Settings button and select Events'onclick. Name the handler as btnSave_ClickHandler. Enter the following code:

        function btnSave_ClickHandler(event)
        {
            var views = document.getElementById('stackLayout');
            var front = document.getElementById('mainScreen');
            if (views && views.object && front) {
                views.object.setCurrentView(front, true);
            }
        }


    Test the application again by pressing Command-r. This time, you will be able to navigate to the settings view by tapping on the Settings button in the mainScreen subview (see Figure 16).


    Figure 16: Tapping on the Settings button navigates to the settings subview


    Database Access
    So far, your application displays two screens where you can perform some currency conversion as well as set the exchange rates for the different currencies. For simplicity, I am going to assume that you are converting the currencies into Singapore Dollars (SGD). All the exchange rates would be based on the SGD as the base currency.

    To allow the users to store their own exchange rates, you will make use of the local database feature as defined in HTML 5 (which is supported by Mobile Safari). Doing so allows users of your application to store the exchange rate locally on their iPhones.

    In the main.js file, add the following lines of code for performing database operations:

        var database = null;                           // The client-side database
        var DB_tableName = "CurrencyKeyValueTable";    // database name

        // Function: initDB() - Init and create the local database, if possible
        function initDB()
        {
            try {
                if (window.openDatabase) {
                    database = openDatabase("ExchangeRatesDB", "1.0",
                                            "Exchange Rates Database", 1000);
                    if (database) {
                        database.transaction(function(tx) {
                            tx.executeSql("SELECT COUNT(*) FROM " + DB_tableName, [],
                            function(tx, result) {
                                loadRates();
                            },
                            function(tx, error) {
                                // Database doesn't exist. Let's create one.
                                tx.executeSql("CREATE TABLE " + DB_tableName +
                                " (id INTEGER PRIMARY KEY," +
                                "  key TEXT," +
                                "  value TEXT)", [], function(tx, result) {
                                    initRates();
                                    loadRates ();
                                });
                            });
                        });
                    }
                }
            } catch(e) {
                database = null;
            }
        }

        // Function: initRates() - Initialize the default exchange rates
        function initRates()
        {
            if (database) {
                database.transaction(function (tx) {
                    tx.executeSql("INSERT INTO " + DB_tableName +
                        " (id, key, value) VALUES (?, ?, ?)", [0, 'USD', 1.44]);
                    tx.executeSql("INSERT INTO " + DB_tableName +
                        " (id, key, value) VALUES (?, ?, ?)", [1, 'EUR', 2.05]);
                    tx.executeSql("INSERT INTO " + DB_tableName +
                        " (id, key, value) VALUES (?, ?, ?)", [2, 'AUS', 1.19]);
                });
            }
        }

        // Function: loadRates() - Load the currency exchange rates from DB
        function loadRates()
        {
            var element;  
            var popUpElement = document.getElementById('popupConvertTo');

            if (database) {
                database.transaction(function(tx) {
                    tx.executeSql("SELECT key, value FROM " + DB_tableName, [],
                    function(tx, result) {
                        for (var i = 0; i < result.rows.length; ++i) {
                            var row = result.rows.item(i);
                            var key = row['key'];
                            var value = row['value'];

                            //---populate the pop-up menu part---
                            popUpElement.options[i].text = key;
                            popUpElement.options[i].value = value;

                            if (key == 'USD') {
                                element = document.getElementById('txtUSD');
                            }
                            else {
                                if (key == 'EUR') {
                                    element = document.getElementById('txtEUR');
                                }
                                else if (key == 'AUS') {
                                    element = document.getElementById('txtAUS');
                                }
                            }
                            element.value = value;
                        }
                    },
                    function(tx, error) {
                        showError('Failed to retrieve stored information from database - ' +
                            error.message);
                    });
                });
            }
            else {
                loadDefaultRates();
            }
        }

        // Function: saveRates() - Save the currency exchange rates into DB
        function saveRates()
        {
            if (database) {
                var elementUSD = document.getElementById('txtUSD');
                var elementEUR = document.getElementById('txtEUR');
                var elementAUS = document.getElementById('txtAUS');

                database.transaction(function (tx) {
                    tx.executeSql("UPDATE " + DB_tableName + " SET key = 'USD',
                        value = ? WHERE id = 0", [elementUSD.value]);
                    tx.executeSql("UPDATE " + DB_tableName + " SET key = 'EUR',
                        value = ? WHERE id = 1", [elementEUR.value]);
                    tx.executeSql("UPDATE " + DB_tableName + " SET key = 'AUS',
                        value = ? WHERE id = 2", [elementAUS.value]);
                });
            }
            loadRates();
        }

        // Function: deleteTable() - Delete currency exchange table from DB
        function deleteTable()
        {
            try {
                if (window.openDatabase) {
                    database = openDatabase("ExchangeRatesDB", "1.0",
                                            "Exchange Rates Database");
                    if (database) {
                        database.transaction(function(tx) {
                            tx.executeSql("DROP TABLE " + DB_tableName, []);
                        });
                    }
                }
            } catch(e) {
            }
        }

        // Function: loadDefaultRates() - Load the default exchange rates
        function loadDefaultRates()
        {
            var popUpElement = document.getElementById('popupConvertTo');
            var element = document.getElementById('txtUSD');
            element.value = "1.44";
            popUpElement.options[0].text = "USD";
            popUpElement.options[0].value = element.value;

            element = document.getElementById('txtEUR');
            element.value = "2.05";
            popUpElement.options[1].text = "EUR";
            popUpElement.options[1].value = element.value;

            element = document.getElementById('txtAUS');
            element.value = "1.19";
            popUpElement.options[2].text = "AUS";
            popUpElement.options[2].value = element.value;
        }


    The database code above is pretty straightforward - store the exchange rates inside the database and populate the pop-up menu part when the rates are retrieved.

    Modify the load() function as follows:

        //
        // Function: load()
        // Called by HTML body element's onload event when the Web application is ready to
        // start
        //
        function load()
        {
            dashcode.setupParts();

            initDB();   
            if (!database) {
                loadDefaultRates();
            }
        }


    Press Command-r to test the application. When the application is loaded, the pop-up menu will now display the three different currencies (see Figure 17).


    Figure 17: The pop-up menu part displaying the different currencies

    When you tap on the Settings button, the exchange rates would also be displayed in the settings subview (see Figure 18).


    Figure 18: The exchange rates displayed in the settings subview



    Performing the Conversion
    You are now ready to perform the actual conversion of the currencies. In Dashcode, select the mainScreen subview and right-click on the Convert! Button and select Events'onclick (see Figure 19).


    Figure 19: Handling the onclick event for the Convert! button



    Name the event handler as btnConvert_ClickHandler and code it as follows:

        function btnConvert_ClickHandler(event)
        {
            var amount = document.getElementById("txtAmount").value;   
            var rates = document.getElementById("popupConvertTo").value;
            var result = amount * rates;
            alert(result);
        }


    Press Command-r to test the application. Enter an amount and select the currency to convert. Tapping on the Convert! button will now display the amount converted (see Figure 20).


    Figure 20: Try converting some currencies!



    Converting your Web Application into an iPhone Native Application
    Now that your application is completed, you may deploy your application onto a Web server so that users can access your application through the Safari browser on their iPhones. However, since this is a Web application, the user must have access to the Internet, or else there is no way to access your application. And since our application does not make use of any server-based data, it is a good candidate to convert into a native iPhone application. The easiest way would be to host the Web application within the Safari browser, which is represented by the WebView view in the iPhone SDK.

    In this section, I will show you how you can convert an iPhone Web application into a native iPhone application.

    First, deploy your Web application by clicking the Share item in Dashcode (see Figure 21). Click the Deploy button so that all the files of the application will be saved to a Web publishing directory. Take note of the Web publishing directory shown in Dashcode. It is saved in /Users//Sites/CurrencyConvertor/. You will make use of the files contained within this folder shortly.



    Figure 21: Deploying a Web application in Dashcode
    • Launch Xcode and create a new View-based Application project. Name the project as CurrencyConvertor.
    • In Finder, navigate to the /Users//Sites/CurrencyConvertor/ folder and select the files shown in Figure 22.


    Figure 22: All the project files created by Dashcode

    Drag-and-drop all the selected files onto the Resources folder in Xcode. Xcode will prompt you with a dialog (see Figure 23). Check the Copy items into destination group's folder (if needed) checkbox and click Add.


    Figure 23: Adding all the Dashcode files into the Resource folder in Xcode

    Perform a global Find-and-Replace (by pressing Shift-Command-F). Search and replace the following strings with an empty string (see Figure 24):

    Parts/
    Images/



    Figure 24: Replacing all instances of "Parts/" and "Images/" with an empty string

    This will update the various HTML and JavaScript files that reference other files using the Parts/ and Images/ folder. Files stored in the Resources folder of your Xcode application have no directory structure when they are deployed; hence all the files are in a flat directory.

    Select the files shown in Figure 25 and drag-and-drop them onto the Copy Bundle Resources (16) folder. This will ensure that all the HTML, JavaScript, CSS, and images files will be deployed together with your application.


    Figure 25: Copying all the Web files into the targets folder so that they are deployed together with your application


    In the CurrencyConvertorViewController.h file, add the following statements to define an outlet:

        #import

        @interface CurrencyConvertorViewController : UIViewController {
            IBOutlet UIWebView *webView;
        }

        @property (nonatomic, retain) UIWebView *webView;

        @end


    Double-click on the CurrencyConvertorViewController.xib file to open it in Interface Builder.
    Add a WebView view to the View window and control-click and drag the File's Owner item to the WebView view (see Figure 26). Select webView.


    Figure 26: Connecting an outlet to a view

    In the CurrencyConvertorViewController.m file, add the following statements:

        #import "CurrencyConvertorViewController.h"

        @implementation CurrencyConvertorViewController

        @synthesize webView;

        - (void)viewDidLoad {
            NSString *path = [[NSBundle mainBundle] pathForResource:@"index"
                                ofType:@"html"];
            [webView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath: path
                                    isDirectory:NO] ]];
            [super viewDidLoad];
        }


     



    That's it! Press Command-r to test the application on the iPhone Simulator. The Web application is now hosted within the WebView view (see Figure 27). What you have just done is convert a Web application into a native application!

    Figure 27: Running the Web application as a native iPhone application

    Tip of the Day News Mac Tips and Tricks Games ★★★★★ Tips+Tricks MacTips WebApps Tips + Tricks Widgets Downloads iPhoto Safari Tips Apple Free Apps Personal GarageBand iMovie Internet Utilities Multimedia Apple Downloads Pro Tip iWeb Dashboard iTunes Mac Dashcode iDVD DashboardClocks Support 10.8 Applications iLife News OSX Tutorials 10.7 Desktop Mac Tip of the Day AppleTV Dashboard Widgets Finder Firefox MacWidgets OS X Mountain Lion Tips and Tricks TopApps Videos 10.6 Keyboard Shortcuts iPad iPhone Mac 10.9 AirPlay Apps on Mac Dock Just Added Mac App Store MacApps MacNN OS X OS X Lion Softpedia Tricks Updates iCal iLife iLife Widgets iPhone Tips and Tricks FAQ Mail AppShopper.com AppleNews Application Tips Customizing Customizing Your Mac Dashboard Guidelines Developer Widgets Exposé Games Widgets Mac App Store - News Mac OS X 10.6 Mac OS X 10.8 Mountain Lion Mac101 MacNews MacUpdate Mac|Life OS X Daily Preview Snow Leopard Tips Terminal TextEdit Top10 Mac Tips VersionTracker Video Tutorials Windows iCloud iLife 11 iWork  Navigation Key Combos Mac 101 MacSupport OS X 10.8 Mountain Lion OS X Mavericks Search Widgets Security iDVD Widgets iPod 10 Keyboard Shortcuts for Text 9 to 5 Mac A A-Z Glossery - iPhone App ATMac Address Book App App Store - News AppShopper Apple Gazette Apple Keynotes Apple Matters Apple Pro Apple Support Tips Apple Updates AppleInsider Applelinks Apps A-Z Apps Apps Apps Apps on Mac - Dashboard Widget Asteroid Audio Automator B BindApple Blogs + Forums Widgets Business Widgets C Calculate + Convert Changing the background Check external devices Check spelling and grammar Clear Versions History + Auto-Save Cache Data Cult of Mac Cydia D Daily Tips and Tricks Dashboard - Tips+Tricks Dashboard Tips and Tricks Dashboard Widget DashboardCandy DashboardSearch DashboardWidgets.com Desktop Computers Developer Forum Developer News Developer Tips Development Tools Disable restored windows when re-opening specific apps Discussions Display a login banner Display a short message Display system stats Dual Boot OS X 10.7 Lion + OS X 10.8 Mountain Lion E Easy Mac Tips Email + Messaging Widgets Essential Expose Extract and Save Mac Application Icons F Find a MAC Address in Mac OS X Find iMessage Users + Contacts Folders Food Widgets Freeware G Get iTunes track notifications in your Dock Get quick information with widgets Google News H Hackint0sh Hacks Hongkiat How To How to disable the Java web plug-in I IT Industry Today Icons Icons + Screensavers Image Capture Information Widgets InsanelyMac Installation International Widgets J Just Added - iPhone Apps Just Added Downloads Just For Fun Widgets K Keynote Address L Launchpad for Mac OS X Snow Leopard Links Lion M Mac App Store - Business Mac App Store - Developer Tools Mac App Store - Education Mac App Store - Entertainment Mac App Store - Finance Mac App Store - Games Mac App Store - Graphics + Design Mac App Store - Health + Fitness Mac App Store - Lifestyle Mac App Store - Medical Mac App Store - Music Mac App Store - Photography Mac App Store - Productivity Mac App Store - Reference Mac App Store - Social Networking Mac App Store - Sports Mac App Store - Top 50 Mac Apps Mac App Store - Travel Mac App Store - Utilities Mac App Store - Video Mac App Store - Weather Mac Developer Tips Mac OS X Mac OS X 10.7 Lion Mac OS X Applications Mac OS X Things Mac OS X Tips Mac OS X Tips - News Mac OSX Hints Mac OSX Hints - News Mac Quick Tips Mac Tips Mac Tips Daily Mac Tips and Tricks - Desktop App Mac Tips and Tricks - Mac OS X Dashboard Widget Mac360 MacApp MacApper MacFixIt MacLion MacMusic MacOSXAudio.com MacRumors MacTech MacUpdate.com MacintoshOS.com Maciverse Macworld.com - iPhone App Reviews ManiacDev MobileMe News ModMyi.com Most Recent Movies + TV Widgets Music Widgets N Navigating + Selecting Text in Mac OS X Networking + Security Widgets New Application Tips New iPhone Apps News Widgets News on Mac Notification Center O OS X - FAQ OS X 10.7 OS X Basics OS X Mac Tips + Tricks OS X Mountain Lion - News OS X Snow Leopard OSX Basics Open source OpenDashboard P Pages Podcast Widgets Portable Computers Ports and Connectors Preferences Press Release Q R Radio + Podcasts Widgets Rampant Mac - iPhone Wallpapers Rename Files and Folders Restart an external device S SD and SDXC card slot FAQ Safari 5.1 Safari 6 Safari Videos Scheduled Startup and Shutdown Set Up Storage Devices Set up iCloud Shopping Widgets Simple Desks Snow Leopard Softonic - Mac Softonic.com Softpedia - Tips + Tricks Softpedia.com Stacks Staff picks Status Widgets Storage StorePreview Switch 101 Syncing with iTunes System Preferences T TUAW The Apple Blog The Apple Core The Mac Observer The Mac Screencast Guy The MacTips Podcast TheDashboard Time Machine Tools Top 10 Grossing Apps Top 25 Grossing Apps Top 50 Grossing Apps Top iTunes Tips Top10 Paid Apps Top10 Widgets Top50 Dashboard Widgets Translates Transportation Travel Widgets U Updating Useful iPhone Shortcuts Using iChat V W Wallpaper Want More Mac Tips ? Web Apps Webcam Widgets Widget Work X YouTube Videos Z ZDNet apple.stackexchange.com digg gSearch - iPhone App iChat iClarified iCloud + MobileMe iCloud News iCloud system requirements iDesign - iPhone Wallpaper iHackintosh iLife - iPhoto - iMovie - iWeb - GarageBand - iDVD iLife Discussions iLife Discussions - GarageBand iLife Discussions - iDVD iLife Discussions - iMovie iLife Discussions - iPhoto iLife Discussions - iTunes iLife Discussions - iWeb iLife Support iLife System Requirements iLife ’09 iMovie Widgets iOS 4 iOS Developer News iPad - News iPhone - News iPhone 4 iPhone App iPhone SDK iPhoto Widgets iPod - News iPod News iPod Tips and Tricks - iPhone App iPod touch iTunes - Latest Movie Trailers iTunes - News iTunes - Top News iTunes App Store iTunes App Store - All New Applications iTunes Keyboard Shortcuts iTunes News iTunes Plus FAQ macosxtips.co.uk switchtoamac.com thinkmac.net www.freemacware.com ...organise your mac 10 Quick Mac Tips 10.10 101 ASC Animation Slow-Mo Aperture Aperture Glossary Apple Support Communities Boot Camp Bored of your Mac? Collect RSS feed URLS from Mail Create Ringtones in iTunes Customise your desktop + screen saver Does your Mac qualify for free 10.8 upgrade? Download Download YouTube and Other Videos FTP FTP with Finder Finder Tips Gatekeeper Get Mac News Get More Mac and iOS Tips Get More Mac and iOS Tips... Get OS X Tips Get RSS Menu Extension for Safari 6 Get Windows Live Hotmail with Mail Get Yahoo Mail with Mail Get a Homepage - Mac OS X Style Glossary Google Hidden Features Hidden Features in OS X 10.8 Mountain Lion Hotmail Install Windows 8 on a Mac Mac 101 - Get One on One with your Mac... Mac OS X Dashboard Widget Mac Support Mac Tips and Tricks - Learn how to set up MacBasics MacHelp MacVideos News and Help Notification Center Tips OCD Friendly Volume Controls OS X 10.5 to 10.8 Upgrade OS X Features OS X Mavericks Tips OS X Mountain Lion Hompage OS X Mountain Lion Installation Guides OS X Tips Organize Your Dock Quick Define Quick Googling Quick Math RSS Remote Folder and Synchronization Remove Dock Icons in OS X Mountain Lion Reset specific parts of Safari ScreenCast Online Screenshots Search Search Google Search Mac Tips and Tricks Second Clipboard Security Tips Siri Siri Tips Snippets Speed Up Your Mac Stop Automatically Updates Summarize Text System Configuration Take advantage of Quick Look Taking Screenshots Text Tip Tips and Support Top Mac Tips Top Security Tips USB 3 devices on Mac - FAQ Use Smart Folders effectively Which Mac is Worth Your Investment? Widgets On Your Desktop Windows 8 Xcode Xcode Tips Yahoo YouTube iOS Support iPad Support iPhone Support iPod Support onemac.net onemac.org use and troubleshoot your Mac