页面间跳转和传值

来源:互联网 发布:java求二叉树的节点数 编辑:程序博客网 时间:2024/06/05 01:06

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];
效果图:


源码下载:下载

原创粉丝点击