Application Lifecycle & autorelease pools

Application Lifecycle
After application:didFinishLaunchingWithOptions:, then what?
Application enters a “run loop” repeatedly doing the following ...


An autorelease pool is created (more on this in a moment)
Application waits for events (touch, timed event, I/O, etc.)
Events are dispatched through UIKit objects and often on to your objects (via delegates, etc.)
When all is done, the screen is updated (appropriate drawRect: methods are called)
The autorelease pool is drained


Rinse, repeat. 

 

 

注:两次autorelease 对象会导致自动释放池最终两次release 该对象,可能会使程序crash。

 

 

 

posted @ 2011-07-21 16:20  AlexFan  阅读(261)  评论(0编辑  收藏  举报