ios--NavigationViewController跳转、返回传值
来源:互联网 发布:vb round函数 编辑:程序博客网 时间:2024/06/05 11:23
使用NavigationViewController进行页面跳转时,应该使用pushViewController方法来跳转至下一页面,这样的话,下一页面同样在NavigationViewController容器中。
1、跳转到下一页面:
1
2
3
4
5
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、从当前页面返回到上一页面并传值过去:
1
2
3
4
5
6
7
8
//此页面已经存在于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中进行判断并接收传递的值:
1
2
3
4
5
-(
void
)viewDidAppear:(BOOL)animated
{
//判断并接收返回的参数
}
3、从当前页面返回到上一页面(无需传值)的方法:
1
2
3
4
5
//返回到上一界面
-(IBAction)backOff:(id)sender
{
[self.navigationController popViewControllerAnimated:
true
];
}
0 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 页面跳转后去掉返回按钮和返回手势
- 银子交易
- 上门洗车APP --- Android客户端开发 之 网络框架封装介绍(二)
- 手斧Linux – 从LFS到Funtoo (76)
- Ehcache 整合Spring 使用页面、对象缓存
- 概率论与数理统计(3)
- ios--NavigationViewController跳转、返回传值
- cocos2d-x创建新工程
- 6、计数
- 江尤理:多数交易者都会错过70%的行情!恐怖
- Java web中上传文件的重命名
- 7、高级技术原理
- 动态数组类的封装
- Linux硬盘学习
- 疯狂Android讲义(1a)-基于监听的事件处理-控制飞机移动