Implementing Navigation with UINavigationController

Implementing Navigation with UINavigationController

Problem

You would like to allow your users to move from one view controller to the other with a smooth and built-in animation.

Solution

Use an instance of UINavigationController.

#import "AppDelegate.h"

#import "FirstViewController.h"

@interface AppDelegate ()

@property (nonatomic, strong) UINavigationController *navigationController; 
@end @implementation AppDelegate ...

 

- (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{

        FirstViewController *viewController = [[FirstViewController alloc]

                                               initWithNibName:nil

                                               bundle:nil];

        self.navigationController = [[UINavigationController alloc]

                                     initWithRootViewController:viewController];

        self.window = [[UIWindow alloc]

                       initWithFrame:[[UIScreen mainScreen] bounds]];

        self.window.rootViewController = self.navigationController;

self.window.backgroundColor = [UIColor whiteColor]; [self.window makeKeyAndVisible];

return YES;

}

 

如下图所示,我们得到了一个能够跳转的view.

Implementing Navigation with UINavigationController

这个是详情页面

Implementing Navigation with UINavigationController

 

你可能感兴趣的:(controller)