Cocoa Application Start Sequence

1) Click the app's icon or click 'Run' button in the developer,app start to run; app

2) App will load NIB,every class recorded in the NIB file will receive the "alloc" message to create the variable,then app send every new object a "init" message; oop

NIB & XIB: ui

The NIB file will distribute with application when it is distribute; this

The XIB file is used by developer when the app is developed; code

NIB file is small than XIB,developer can only operate the XIB file.Using XIB file to manage all the resources in the application when developing it is easier,but NIB is easier to be analyzed by compiler. it

3) every object in the "step 2" will received a "awakeFromNib" message; io

4) The app will enter the main event loop,at this time user can operate the app now.every operate action will be in the event queue,and the app will execute the related mode code to completed the user's command and re-draw the window & view when it is necessary; event

the main event loop include "screen","mouse","keyboard" event class

5) app receive the user's "quit" command,the app will be end,every object will be release. cli

相關文章
相關標籤/搜索