开发者

iOS Root Controllers

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜