开发者

iOS Root Controllers

开发者 https://www.devze.com 2023-03-08 18:59 出处:网络
What is the difference between these two methods when adding a root controller: self.window.rootViewCo开发者_JAVA百科ntroller = self.viewController;

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

self.window.rootViewCo开发者_JAVA百科ntroller = self.viewController;
[self.window makeKeyAndVisible];

And:

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

Cheers, Peter


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消