Peter Warbo
Peter Warbo

Reputation: 11728

iOS Root Controllers

What is the difference between these two methods when adding a root controller:

self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];

And:

[self.window addSubview:rootController.view];
[self.window makeKeyAndVisible];    

Cheers, Peter

Upvotes: 0

Views: 173

Answers (1)

Peter Warbo
Peter Warbo

Reputation: 11728

After reading the documentation it seems that the rootViewController property is as of iOS SDK 4.0 and addSubview has been since iOS SDK 2.0.

I've tried using them both and they seem to do exactly the same thing. So I suppose if you want to support iDevices < 4.0 you should use the [self.window addSubview:controller.view] method.

Upvotes: 1

Related Questions