Home arrow Smartphone Development arrow iOS Development: Hello World! in Xcode Part 2

iOS Development: Hello World! in Xcode Part 2

This second part in a series on developing your first iOS app using Xcode delves into the code of our "Hello World" application.

By: Richard Bagley
Rating: starstarstarstarstar / 0
January 23, 2012

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

In this part of the tutorial, I will be discussing the code showcased in part one of this series (http://www.devshed.com/c/a/Smartphone-Development/iOS-Development-Hello-World-in-Xcode-48394/), as well as the general concepts required to program under iOS.

As was mentioned before, I used Xcode 4.1 to create the test project for our discussion. In this version several items are automatically generated when Xcode creates the project. Our main focus for this article will be the HelloWorldAppTutorialAppDelegate header and code files. First, let us look at the header file generated by Xcode.

 


The first line is  the standard import function  used to make the standard iOS objects available to the object that was generated by Xcode for the the running class of the program. The next line establishes the class that will be running on the device and managing the events of the program. B
  asically, it states the the HelloWorldAppTutorialAppDelegate is being generated and that this class is a subclass of the NSObject class. The next line creates the window that is used throughout the use of the program.

 


Next, is the code file that was generated along with the header file. In this case, the focus will only be on the section of the code that was actually changed in our tutorial. While the other portions of the code are important to application development in iOS, they are not important for the general concepts we are covering in this tutorial. Out main focus is on the didFinishLaunchingWithOptions method.


First, the method creates the area container that the UILabel will be displayed in. While this is not required, there are some uses to using this method such as allowing for borders around the UILabel and specific shading around the label. There are properties available for such customization. The UILabel is then created and its properties setup including the standard “Hello World” message. Finally the UILabel is added to the program window and the window is visible to the user and actions taken within the program by the program will be able to be processed by the program.

Finally, the memory that was used by the label is setup to be released when the application closes. This is required in Object-C because the language does not have a Garbage Collection process to release this memory automatically.

 


 
 
>>> More Smartphone Development Articles          >>> More By Richard Bagley
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

SMARTPHONE DEVELOPMENT ARTICLES

- Is Facebook Working on a Branded Smartphone?
- Apple iOS 6 Packed With Features
- Finally, Ubuntu OS for Smartphones?
- App Developers Offer Thoughts on Windows Pho...
- App Promo Survey Displays Developer Struggles
- Apptopia Market Helps Developers Recoup Inve...
- Is Fragmentation a Plus for App Developers?
- Juniper Networks: Android App Malware Increa...
- Developer's Losing Interest in Android?
- Android Developers Pushed Towards Google Wal...
- Google Increases Android App Size Limit
- ATandT To Charge App Developers, Android Lac...
- Android Slipping in App War versus Apple
- Apple and Google Battle to Clean Up App Mark...
- iOS Development: Hello World! in Xcode Part 2

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: