In this article, we will give you an understanding of how to create a simple iPhone Application. At the end of this article, you will have your First iPhone Application created and the architecture understanding of the iPhone Application.
We hope you have configured, the Development environments properly, if you haven’t done so please have a look at one of our articles here.
Getting started with First iPhone Application
- Open Xcode
- Hit “Command + Space” together, Spotlight Search appears, write Xcode and click on enter.
- Click on “Create a new Xcode Project“.
- A window will appear asking to choose a template for the kind of application you are trying to create.
- Select “Single View App“.
- Click “Next” to Proceed Further.
- Another Window will appear asking for the name of the project and initial configurations, we have named the project as “FirstApplication”.
- Select the desired language in which you want to code, it can be Objective C or Swift.
- A Finder window will appear asking for the destination location, where the project needs to be saved.
- As soon as the project is saved, this will be the status of the project as of now.
- Run the project. (Command + R)
- We will now add a simple label and see the effects on the UI.
- Navigate to main.Storyboard file to make changes to the UI.
- Drag and drop a UILabel
- Set Frame and X, Y position of the UILabel
- Set Text and desired fonts.
- Run the Project. (Command + R)
Note: Now we are all set as you can see this in front of you, a Xcode project is started and now you can kick-off development. We have configured a basic iPhone Application.
Basic Understanding of Xcode.
We will now have a brief details of all the area’s in the XCode.
Toolbar: Here you can see options like:
- Run the build and stop the build
- Run (Play icon) – Shortcut (Command + R)
- Stop (Stop box icon)
- Select the Device in which you want to run the application (Drop down after play and stop build)
- Status of the application like
- Indexing of the build
- Building process
- Running state
- Editors pane
- Top right corner (open close Navigation area, Console area and Utility area)
Editor Area: This is the portion of the XCode where we see the current file open for editing and may XIB’s or Storyboards to be edited.
Navigation Area: Here the whole structure of the project is visible, we can access any file in the project from this space.
Console Area: All the debug logs, OS Activity can be viewed in the console.
Utility Area: Here the configuration of each and every file is handled, like Auto layouts, Attributes, Class Allocation to XIB’s etc.
- Run the Project and see the output. (Command + R to run the project)