Ray's playground

 

Introducing the iPhone SDK(Chapter 1 of The iPhone™ Developer’s Cookbook)

  The main.m file has two jobs. First, it creates a primary autorelease pool for your application. Second, it invokes the application event loop.These two elements provide critical elements to get your application started and running. Here is what those two items are and how they work.
code
1 int main(int argc, char *argv[])
2 {
3   NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
4   int retVal = UIApplicationMain(argc, argv, nil, @"MyAppDelegate");
5   [pool release];
6   return retVal;
7 }

 

   Autorelease pools are objects that support the iPhone’s memory management system.This memory system is normally based on keeping track of reference counts, that is, counting how many objects refer to an allocated part of memory.

  Target-actions are a lower-level way of redirecting user interactions.You encounter these almost exclusively for children of the UIControl class.With target-action, you tell the control to contact a given object when a specific user event takes place. 

posted on 2010-10-12 12:35  Ray Z  阅读(215)  评论(0编辑  收藏  举报

导航