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.
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
Think Tank
I really enjoyed your Obj-C tutorials; you explain things very well. I have a simple iDevice App. idea but I just don’t know how to set everything up to make it work. I’m hoping that you can help steer me in the right direction.
I want to type in a name, hit “enter” have it return 1-8 names back to a web-view or text-box. All the data needed is now on an Excel Spreadsheet 4 columns wide by 1500 rows deep. Keeping the spreadsheet up-to-date is why I think I need a website. Could the Google cloud work? Can Safari handle the search and return work? Do I need to put the data into JSON or another form?
Any help would be appreciated. You have the experience to see the big picture and I respect your opinion. I think some of these practical App. uses would make good tutorial material.
I’m glad you liked them. Thank you 🙂 I haven’t really worked on iPhone apps for a couple of years. I have been making Android apps now for a while instead. If you are interested in making Android apps I’m just starting a big tutorial right now. I’ll cover everything you need to know and much more. I decided to make Android apps instead because there are very few great apps and meanwhile more people have them instead of iDevices. I hope that helps