一、
跳转到SecondViewController.xib页面:
controller = [[SecondViewcontroller alloc] initWithNibName:@"SecondViewController"] bundle:nil];
[self presentViewcontroller:controller animated:YES completion:nil]; // 跳转到SecondViewController.xib 页面
从SecondViewController.xib页面跳会到原来页面:
[self dismissViewControllerAnimated:No completion:nil]; // 跳回原来的页面
实例代码下载
二、 用 UINavigationcontroller
在 AppDelegate.m 代码如下:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
self.window.backgroundColor = [UIColor whiteColor];
ViewController *vc = [[ViewController alloc] init];
UINavigationController *navigation = [[UINavigationController alloc] initWithRootViewController:vc];
self.window.rootViewController = navigation;
[self.window makeKeyAndVisible];
return YES;
}
在 ViewController.m 代码片断如下:
- (void)goNext {
SecondViewController *second = [SecondViewController new];
[self.navigationController pushViewController:second animated:YES];
}
实例代码下载
未完待续...