Iphone 如何在基于视图的应用程序中创建NavigationController?

Iphone 如何在基于视图的应用程序中创建NavigationController?,iphone,uinavigationcontroller,Iphone,Uinavigationcontroller,如何创建NavigationController以用于基于视图的应用程序? 将此代码 在delegate.h类中 MyViewController *viewController; 在delegate.m类中 - (void)applicationDidFinishLaunching:(UIApplication *)application { UINavigationController *nvcontrol =[[UINavigationControlle

如何创建NavigationController以用于基于视图的应用程序?

        • 将此代码

          在delegate.h类中

                MyViewController *viewController;
          
          在delegate.m类中

           - (void)applicationDidFinishLaunching:(UIApplication *)application {    
          
          UINavigationController *nvcontrol =[[UINavigationController alloc] initWithRootViewController:viewController];
          
          [window addSubview:nvcontrol.view];
          
          [window makeKeyAndVisible];
          
          }
          
          此处“MyViewController”应替换为您的viewcontroller

          祝您一切顺利。

          请输入此代码

          在delegate.h类中

                MyViewController *viewController;
          
          在delegate.m类中

           - (void)applicationDidFinishLaunching:(UIApplication *)application {    
          
          UINavigationController *nvcontrol =[[UINavigationController alloc] initWithRootViewController:viewController];
          
          [window addSubview:nvcontrol.view];
          
          [window makeKeyAndVisible];
          
          }
          
          此处“MyViewController”应替换为您的viewcontroller

          祝您一切顺利。

          在delegate.h中

          @class test24ViewController;
          
          @interface test24AppDelegate : NSObject <UIApplicationDelegate> {
              UIWindow *window;
              test24ViewController *viewController;
              UINavigationController *nav;
          }
          
          @property (nonatomic, retain) IBOutlet UIWindow *window;
          @property (nonatomic, retain) IBOutlet test24ViewController *viewController;
          @property (nonatomic, retain) IBOutlet UINavigationController *nav;
          
          在delegate.h中

          @class test24ViewController;
          
          @interface test24AppDelegate : NSObject <UIApplicationDelegate> {
              UIWindow *window;
              test24ViewController *viewController;
              UINavigationController *nav;
          }
          
          @property (nonatomic, retain) IBOutlet UIWindow *window;
          @property (nonatomic, retain) IBOutlet test24ViewController *viewController;
          @property (nonatomic, retain) IBOutlet UINavigationController *nav;
          

          启动基于导航的应用程序并迁移代码。您需要更加具体。我们无法帮助您,除非您明确说明问题所在,并可能显示一些相关代码。启动基于导航的应用程序并迁移代码。您需要更加具体。我们无法帮助您,除非您明确说明您的问题所在,并可能显示一些相关代码。