1.先修改appdelegate
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override point for customization after application launch.
FirstViewController *rootView=[[[FirstViewController alloc]init]autorelease];
self.navController=[[[UINavigationController alloc]init]autorelease];
[self.navController pushViewController:rootView animated:YES];
[self.window addSubview:self.navController.view];
[self.window makeKeyAndVisible];
然后传值和跳转:
SecondViewController *SecondView= [[[SecondViewController alloc] init]autorelease];
SecondView.str=_tf01.text;
[self.navigationController pushViewController:SecondView animated:YES];
返回
[self.navigationController popViewControllerAnimated:YES];
效果图:
源码下载:下载