uiviewcontroller - different ways to call window? in objective-c -


i wondering : in different tutorials, use first 2 lines, instead of 2 last lines set default , same purpose :

        [window addsubview:viewcontroller.view];         [window makekeyandvisible];          self.window.rootviewcontroller = self.viewcontroller;         [self.window makekeyandvisible]; 

(because rootviewcontroller set default.) change anything?
thanks

in first case:

 [window addsubview:viewcontroller.view] 

you adding view controller view's subview of window.

while in

 [self.window.rootviewcontroller = self.viewcontroller] 

you identifying root view controller window self.viewcontroller. same thing because identifying root viewcontroller making viewcontroller's view subview of window.

basically first way old way it, since property rootviewcontroller new in ios 4.0. new way makes clearer top view of application.


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -