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
   

SMARTPHONE DEVELOPMENT ARTICLES

- Apple and Google Battle to Clean Up App Mark...
- iOS Development: Hello World! in Xcode Part 2
- Android, iOS End 2011 Strong, comScore Repor...
- iOS Development: Hello World! in Xcode
- Mobile Apps Becoming the New King of Media
- Incentivized Apps Fail to Make a Lasting Imp...
- Android Market Surpasses 10 Billion, Apple i...
- Smartphone Ice Cream Sandwich, Android Enter...
- Adobe Promises New Version of Flash for Mobi...
- Young Developers Make a Splash in App Market
- Loss of Adobe Mobile Flash Leaves a Void, or...
- Adobe Ceases Future Development of Flash for...
- RIM, BlackBerry Face an Uphill Climb
- Android Version of NoScript for Firefox Now ...
- Nokia and Microsoft Attempt to Attract Symbi...


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 4 - Follow our Sitemap

Dev Shed Tutorial Topics: