gpt4 book ai didi

ios - XCode/iOS - AppDelegate 中 ViewController 的引用

转载 作者:可可西里 更新时间:2023-11-01 05:42:11 26 4
gpt4 key购买 nike

在我看来,我的 iPad 应用程序会自行加载 Storyboard 文件及其 ViewController。我在 plist 文件中看到“主 Storyboard 文件基本名称”的条目。

来 self 曾经在 Xcode 中创建“空应用程序”的背景,然后我将创建 UIViewController 以及 nib 文件,在内部实例化

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

并添加到 View 中,我已经引用(变量)到这个 ViewController 对象

现在在这个“单 View 应用程序”中,我没有看到任何对基于 Storyboard 的 ViewController 的引用,我需要有一个引用来做一些工作。请指教。

最佳答案

查看此问题以获取有关通过 Storyboard访问 View Controller 的一些示例代码 - Accessing a view controller created through Storyboard using the App Delegate

对于基本答案,您应该能够引用“window”属性。您应该能够使用“窗口”引用的属性来引用您的其他 View 。有一个“rootViewController”属性附加到 UIWindow。

UIWindow 文档 - http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIWindow_Class/UIWindowClassReference/UIWindowClassReference.html

关于ios - XCode/iOS - AppDelegate 中 ViewController 的引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10918231/

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