Saturday 25 May 2013

Starting iOS/iPhone Programming

Hi Guys,

This tutorial is purely targeted for programmers who are planning to start iOS programming. Okay, lets start now. First see what are the pre-requisites of iOS programming :

1. Understanding of Object Oriented Concepts.
2. Mac Machine
3. Some spare time....

Apple providing a lot of frameworks to programmers to develop third party iOS applications. You can find list of available frameworks here http://developer.apple.com/library/ios/#documentation/miscellaneous/conceptual/iphoneostechoverview/iPhoneOSFrameworks/iPhoneOSFrameworks.html

All these frameworks are written in Objective C programming language. So, to build an iOS application we need learn Objective C. We will discuss more about Objective C in our next tutorials.

For now lets build an simple iOS application to give a better understanding of the tools we use to build iOS/iPhone/iPad applications.

XCode : This is the IDE we use to develop iOS applications. This is where we can write code, debug, compile and execute.
Interface Builder : For the benefit of iOS programmer, Apple provided interface builder feature to drag-drop UI elements instead of writing code to create them. If we want we can write code to programmatically create UI components though. Earlier this is independent application till Xcode 3.x. From Xcode 4.x Interface builder is integrated into Xcode itself. (See right bottom corner. U will see UI elements like label, button etc).
iPhone and iPad Simulators : Ok, here comes the actual component. Simulators!!!! If we develop an web application we will see the output on a web browser. Similarly, if we want to see output of an iOS application, we have iPhone/iPad simulators. We can use real iPhone/iPad devices also to test the output. But to do that we need a apple developer account(https://developer.apple.com/). We will see how to run an iOS applications on a real device in our future tutorials.





















Okay, now first create a XCode project. Select, Xcode from dock. From top menu, select File -> New -> Project

Select Single View Application

Give Project name, Organization Name and select iPhone in devices option. Uncheck all the check boxes. We will do examples related those in next tutorials.
Now, lets select ViewController.xib from the project navigator menu of XCode. It is a interface builder file. We can drag and drop UI elements on to the xib file. Drag and drop a label and set its properties from the properties view which appears above the elements group.

Lets center align label text and give text as "My First iOS Application". You can give label text by double clicking on the label or assigning text to "Text" property in properties view.

Now using color panel, change the background color of the view to white color.



Now run the iPhone application using command "Cmd+R" keys or by clicking the Run button appears on top left corner of the XCode. You see out put on iPhone simulator. (iPhone 3.5 inches).


Following screen shows output for iPhone 5(4 inches) retina display.


I hope you guys have enjoyed the tutorial. Please feel to add your comments. Please download source code from here MyFirstiOSApplication Source Code

1 comment:


  1. This is a very nice article. thank you for publishing this. i can understand this easily.!!..iPhone Online Course

    ReplyDelete