objective c - What type of code correct: addSubview or direct controller assignment in AppDelegate? -



objective c - What type of code correct: addSubview or direct controller assignment in AppDelegate? -

what type of code right , how works each of them (what difference between first , sec if result same):

in application:didfinishlaunchingwithoptions: create first controller's view visible can utilize such method:

[self.window addsubview:mycontroller.view]; [self.window makekeyandvisible];

or

self.window.rootviewcontroller = self.mycontroller; [self.window makekeyandvisible];

what diffs ?? , right , more safely ?

regards, alex.

window inherited uiview

rootviewcontroller property of window not uiview.

the root view controller provides content view of window. assigning view controller property (either programmatically or using interface builder) installs view controller’s view content view of window. if window has existing view hierarchy, old views removed before new ones installed.

the default value of property nil.

addsubview method inherits uiview.

if u utilize firsttime ur window same effect u get.

objective-c ios view uiviewcontroller

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -