{infiniteZest}
// Articles. Tutorials. Utilities.
Home  |   Search  |   Login  
Categories Skip Navigation Links
New / All
AJAX
Apple
ASP.NET
.NET
Git
Google / Android
Python / IronPython
Miscellaneous
SQL Server
Test Your Knowledge: Understanding a Typical main Method in Objective-C for iPhone Development
Summary
This is a test on the article that explains various pieces of the main() method. For iPhone and iPod Touch applications, you would consistently see the same main() method, where an application starts.
 
Table of Contents

The Starting point

Code Listing 1. The main() method in Objective-C programs

Figure 1. The annotated main method.

The import

Code Listing 2. Importing UIKit

UIKit Framework

Figure 2. The UIKit.framework from Xcode. The header files that are part of the framework are shown on the left. The contents of UIKit.h file are shown on the right.

UIKit Header File

Code Listing 3. The header file UIKit.h. As you can see the header files for UI element classes are here: Accelerometer, Alert, Application, Button, Color, Date Picker, Scroll View, Slider, and so on.

Need for UIKit.h in main.m

The main() signature

Code Listing 4. Signature of the main() method

The arguments

Code Listing 5. Finding the values of argc and argv[0] of a simple iPhone application from GDB. The location in argv[0] points to a folder for iPhone Simulator

Auto Release Pool and memory management

Code Listing 6. The autorelease pool

Code Listing 7. Autoreleasing an object

Main (UIApplicationMain) from the CocoaTouch framework

Code Listing 8. UIApplicationMain() method

Code Listing 9. Declaration of UIApplicationMain() method in its header file

 
Take the Test
Start the Test:
Understanding a Typical main Method in Objective-C for iPhone Development
Read the Article
Go to Article:
Understanding a Typical main Method in Objective-C for iPhone Development
Review Answers for Questions in this Test
Article Series
Previous Article:
Understanding a Typical main Method in Objective-C for iPhone Development
This article is part of the Series:
Article Series: Getting started with iPhone development
Next Article:
Application Delegate for the First iPhone Application Explained
Bookmark and Share This

More Articles With Similar Tags
This is a test on the article that gives a quick overview of the development tools installed with iPhone SDK. These tools include Xcode, Interface Builder, Instruments, and iPhone Simulator. In the article, Dash Code, which is used to build web applications for iPhone is also introduced. GDB, the open source debugger, is discussed there as well.
icon-xcode-groups-files.jpg
This article discusses various parts of the Project window inside an Xcode project. It also gives a quick overview of the Groups and Files navigation window. The Run menu, the default toolbar, and the built-in source editor are also discussed.
This is a test on the article that discusses various parts of the Project window inside an Xcode project. It also gives a quick overview of the Groups and Files navigation window. The Run menu, the default toolbar, and the built-in source editor are also discussed.
icon-xcode-interface-builder-connection-panel.jpg
This article explains the user interface files of an iPhone application. Explains the contents of the .xib files, which store the user interface. Goes through the various windows (Document Window, User Interface Window, Inspector Window, Library Window, Connections Panel) of the Interface Builder. The example used is a simple navigation-based iPhone application.
This is a test on the article that explains the user interface files of an iPhone application. It explains the contents of the .xib files, which store the user interface. Goes through the various windows (Document Window, User Interface Window, Inspector Window, Library Window, Connections Panel) of the Interface Builder. The example used is a simple navigation-based iPhone application.
About  Contact  Privacy Policy  Site Map