iPhone 开发 - RootViewController 在基于导航的应用程序中在哪里实例化?
我似乎找不到它实际实例化的地方。我查看了 myProjAppDelegate.m 并看到了这个:
self.window.rootViewController = self.navigationController;
但它说窗口的 rootViewController 属性实际上只是一个 UIViewController,而不是 UITableViewController,而 UITableViewController 是 RootViewController.m 类的子类。我在 RootViewController.m 中编写了一个自定义方法,并尝试在 myProjAppDelegate.m 中的 self.navigationController 上调用它并获得了 SIGABRT,所以看起来这不是它。有人可以帮我吗?
I can't seem to find where it's actually instantiated. I looked in the myProjAppDelegate.m and saw this:
self.window.rootViewController = self.navigationController;
But it says that the window's rootViewController property is really just a UIViewController, not a UITableViewController, which is what the RootViewController.m class is a subclass of. I wrote a custom method in my RootViewController.m and tried to call it on self.navigationController in myProjAppDelegate.m and got a SIGABRT, so it seems like this is not it. Can anyone help me out?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它在代码中不可见。您的 MainWindow.xib 包含一个窗口和一个导航控制器,它们通过插座连接到您的 AppDelegate。
当应用程序加载 .xib 文件时,窗口和导航控制器都会被实例化。
Window内部(在MainWindow.xib中)是一个RootViewController,也就是你所说的RootViewController。
关于类,UITableViewController继承自UIViewController。
It's not visible in code. Your MainWindow.xib contains a Window and a Navigation Controller which are connected via outlets to your AppDelegate.
Both the Window and the Navigation Controller get instantiated when the application loads the .xib files.
Inside the Window (in the MainWindow.xib) is a RootViewController, that is the RootViewController you are talking about.
Regarding the class, UITableViewController inherits from UIViewController.