gpt4 book ai didi

iphone - self.window.rootViewController 与窗口 addSubview

转载 作者:IT老高 更新时间:2023-10-28 11:35:42 24 4
gpt4 key购买 nike

我注意到 Application Delegate 中有很多 iPhone 应用示例

- (void)applicationDidFinishLaunching:(UIApplication *)application

[window addSubview: someController.view]; (1)

相对于

self.window.rootViewController = self.someController; (2)

是否有任何实际理由使用其中一个而不是另一个?一个在技术上是正确的吗? Controller 是否有与数字 (2) 等效的命令,例如

self.someController.rootController = self.someOtherController;//伪代码

最佳答案

UIWindow rootViewController 属性是 iOS4 的新属性。

较旧的技术是使用 addSubview

新的推荐技术是设置 rootViewController

关于iphone - self.window.rootViewController 与窗口 addSubview,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5248460/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com