开发者

UINavigationController template

开发者 https://www.devze.com 2022-12-17 23:19 出处:网络
When I open the new file dialog I see only 3 Cocoa Touch Classes: Objective-C class, Objective-C test case class, UIViewController s开发者_开发问答ubclass. When I last worked with Xcode, before I upda

When I open the new file dialog I see only 3 Cocoa Touch Classes: Objective-C class, Objective-C test case class, UIViewController s开发者_开发问答ubclass. 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?


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.

YourViewController *viewController = [[YourViewController alloc] initWithNibName:@"YourView" bundle:nil];

viewController.delegate = self;

UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];

[self presentModalViewController:navigationController animated:YES];


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消