iphone - What is the use of Main Interface option in the build settings for iOS application? -
when start single view application , instead of assigning rootviewcontroller programmatically appdelelgate, try use 'main interface' option assign xib main interface file, 'sigabrt' signal send program when run it. why happen? purpose of main interface option?
i found out how this. obvious after understood whole process of how application loaded. thought i'll answer own question.
the key initialize window , set uiapplication , delegate xib itself.
- step 1: create xib
uiwindow
object in it. make file's owner of xibuiapplication
. - step 2: create
appdelegate
object in xib , connect file's owner'sdelegate
outlet object. - step 3: create outlet window in
appdelegate
class. - step 4: select maininterface option in build settings xib created.
- step 5: comment out code in
applicationdidfinishlaunchingwithoptions:
method.
if run program show window in simulator, you'll warning application supposed have rootviewcontroller
@ end of application launch.
- step 6: inside
applicationdidfinishlaunchingwithoptions:
can instantiateuiviewcontroller
, assign window outlets rootviewcontroller view controller.
Comments
Post a Comment