当我打开新文件对话框时,我只看到3个Cocoa Touch类: Objective-C类,Objective-C测试用例类,UIViewController子类。当我上一次使用Xcode时,在我更新它之前,我记得有超过3个选项,其中包括我正在寻找的: UINavigationController。
那么我在哪里可以找到这个模板来创建UINavigatonController子类呢?
发布于 2010-01-20 01:26:40
苹果公司对Xcode的文件创建界面做了很多改变,他们也让我大吃一惊。我不是很确定你的导航控制器想要完成什么,但是iPhoneDevSDK论坛上的这篇文章解释了为什么你不应该继承UINavigationController,而是以模态的方式呈现你的视图。
iPhoneSDK Forum UINavigation Controller Subclassing
除了论坛中关于模式视图控制器的讨论之外,这里还有来自Apple的view Controller编程指南的源代码,它解释了如何实现这一点。
YourViewController *viewController = [[YourViewController alloc] initWithNibName:@"YourView" bundle:nil];
viewController.delegate = self;
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
[self presentModalViewController:navigationController animated:YES];发布于 2010-01-20 01:19:30
在UINavigationController的头文件协议中找不到所需的方法。我不确定以前的模板是什么样子的,但您可以尝试使用旧的类重新创建一个模板,或者只检查头文件中您希望通常实现的方法,并为其存储您自己的模板。
https://stackoverflow.com/questions/2095156
复制相似问题