This is the second series I’m doing on iPhone and iPad programming. The first time I covered the underlying language called Objective C. If you haven’t seen that already, go there first. Objective C Tutorial
In this series I will teach you how to program for the iPhone / iPad, by showing you how to make working app’s. First, you need to understand the concept of the Model-View-Controller.
In the programming world there are things called Design Patterns. You really should understand OOP Principle’s before you try to move into the world of Design Pattern’s. Go here to learn Object Oriented Programming.
If you understand OOP, you’ll understand that a Design Pattern tells you how to structure objects and classes so that you can best solve specific problems. By using a Design Pattern:
So, now back to the Model-View-Controller. The whole framework used to program on the iPad and iPhone, is based on the MVC. Let me give an example on how a user of your app will interact with the MVC interface:
To break it down simply, the Model is the brain of the app. It knows what the app is doing at all times, knows when anything has been changed, knows what function to call when anything occurs.
The View knows when someone has interacted with it.
The Controller is contacted when the View has been interacted with and then decides what to tell the Model.
If you don’t quite get it, a few example’s should make it very clear.
The Tool’s you Need
You need the following tool’s to write iPhone/ iPad app’s:
There are three versions of the iPhone SDK, which are all the program’s you’ll use to program with. They are:
In this presentation I’ll be using the Free & Standard SDK. You’ll more than likely use the same.
What Tool’s do you Get with the SDK
The Tragic Eleven Ball
The app we are going to make is called the Tragic eleven ball. It will allow the user to ask the iPhone a question, click a button and then get some bad news. I’ll walk you through how every line of code works.
Start up XCode
You are on your way to creating your first app. The XCode Application has many part’s:
Groups & Files
I feel I should provide some detail on the types of file’s contained in the Groups & Files Window:
Classes: This is were most of your code will reside. Since you named your Project Hello World, some file’s have already been created for you, as you can see if you click on the arrow next to that folder.
Other Sources: Here you will find pre-created framework’s (code library’s) and the main() method for your app. These file’s are also pre-made for you.
Resources: Here you store any data you might need. Such as: your app’s icon, Hello_WorldViewController.xib (the controller for your app), MainWindow.xib (The code needed to build your interface, or view) and the plist file that contains info on your app.
Frameworks: Pre-made code libraries available for your use.
Products: Contain’s the working app, after you compile it.
That’s All Folk’s
I hit you with a lot of information in this article. Tomorrow, or in the next article I create the rest of the code needed for the Tragic Eleven ball.
If you have any questions leave them below
Here to Serve