ios--NavigationViewController跳转、返回传值
来源:互联网 发布:java中public static 编辑:程序博客网 时间:2024/05/17 04:28
使用NavigationViewController进行页面跳转时,应该使用pushViewController方法来跳转至下一页面,这样的话,下一页面同样在NavigationViewController容器中。
1、跳转到下一页面:
AloneSetPrizeViewController *setPrize = [[AloneSetPrizeViewController alloc] init];//所要跳转页面AloneSetPrizeViewController中有个属性dictionary1是个NSMutableDictionary类型的容器[setPrize.dictionary1 setObject:[self.txtPassWd text] forKey:ALONE_SITEPRIZE_PWD];//使用pushViewController跳转到下一页面[self.navigationController pushViewController:setPrize animated:true];
2、从当前页面返回到上一页面并传值过去:
//此页面已经存在于self.navigationController.viewControllers中,并且是当前页面的前一页面 AloneSetSiteViewController *setPrizeVC = [self.navigationController.viewControllers objectAtIndex:self.navigationController.viewControllers.count-2];//初始化其属性setPrizeVC.dictionary = nil;//传递参数过去setPrizeVC.dictionary = [NSMutableDictionary dictionaryWithDictionary:self.dictionary1];//使用popToViewController返回并传值到上一页面[self.navigationController popToViewController:setPrizeVC animated:true];
返回到上一页后,上一页面显示后要接收参数,并刷新。注意此时应该在viewDidAppear中进行判断并接收传递的值:
-(void)viewDidAppear:(BOOL)animated{ //判断并接收返回的参数}
3、从当前页面返回到上一页面(无需传值)的方法:
//返回到上一界面-(IBAction)backOff:(id)sender{ [self.navigationController popViewControllerAnimated:true];}
1 0
- ios--NavigationViewController跳转、返回传值
- ios--NavigationViewController跳转、返回传值
- ios--NavigationViewController跳转、返回传值
- ios NavigationViewController跳转以及返回传值
- ios--NavigationViewController返回并刷新UITableView页面
- ios--NavigationViewController返回并刷新UITableView页面
- NavigationViewController 返回到根视图
- NavigationViewController
- NavigationViewController
- ios 导航控制器UInavigationController跳转以及返回传值
- 用UIButton实现页面跳转(AppDelegate +NavigationViewController)
- ios页面跳转传值
- iOS 直接页面跳转与返回
- ios 指定返回的跳转页面
- iOS 模态跳转与返回
- iOS多级跳转,返回指定viewcontroller
- iOS层级跳转(UINavigationController跳转返回到指定的页面)
- iOS 页面跳转后去掉返回按钮和返回手势
- JAVA的依赖注入模式(Dependency Injection Design Pattern in Java)
- UIScrollView实现循环滚动(一)
- K-Means 算法
- 基于 Android NDK 的学习之旅-----Android.mk 介绍
- 最好的教程
- ios--NavigationViewController跳转、返回传值
- java 匿名内部类
- mysql-故障转移+负载均衡群集
- 大家知道理解模型?谈下视图-控制器的见解
- Spring 中配置定时器
- 数据结构基础(9)------------简单选择排序(Simple Selection Sort)
- SignalR使用方法
- C语言标准库函数 qsort详解
- window 常用快捷键,开始-运行命令整理.---快捷开发及操作