UINavigationController 模板
当我打开新文件对话框时,我只看到 3 个 Cocoa Touch 类:Objective-C 类、Objective-C 测试用例类、UIViewController 子类。当我上次使用 Xcode 时,在更新之前,我记得有超过 3 个选项,其中包括我正在寻找的:UINavigationController。
那么在哪里可以找到这个模板来创建 UINavigatonController 子类呢?
When I open the new file dialog I see only 3 Cocoa Touch Classes: Objective-C class, Objective-C test case class, UIViewController subclass. When I last worked with Xcode, before I updated it, I remember there were more than 3 options, which included what I'm looking for: UINavigationController.
So where can I find this template to create a UINavigatonController subclass?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Apple 对 Xcode 的文件创建屏幕进行了大量更改,这也让我感到措手不及。我不太确定您的导航控制器试图完成什么任务,但 iPhoneDevSDK 论坛上的这篇文章解释了为什么您不应该继承 UINavigationController 的子类,而应该以模态方式呈现您的视图。
iPhoneSDK 论坛 UINavigation 控制器子类化
除了论坛中关于模态视图控制器的讨论,这里是来自 Apple 视图控制器编程指南的源代码,解释了如何实现这一点。
Apple's made a lot of changes to Xcode's file creation screen and they've caught me of guard as well. I'm not exactly sure what your navigation controller is attempting to accomplish, but this post at the iPhoneDevSDK forum explains why you shouldn't subclass UINavigationController and instead present your view modally.
iPhoneSDK Forum UINavigation Controller Subclassing
In addition to the discussion in the forum about modal view controllers, here is source code from Apple's View Controller programming guide that explains how accomplish this.
在
UINavigationController
的头文件协议中找不到必需的方法。我不确定旧模板过去是什么样子,但您可以尝试使用旧类之一重新创建一个模板,或者只检查头文件中您想要通常实现的方法并为其存储自己的模板。There are no required methods found in the header file protocols for
UINavigationController
. I'm unsure what the old template used to look like, but you could try re-creating one using one of your old classes, or just examine the header file for the methods you want to commonly implement and store your own template for it.