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.
精彩评论