• 跳转第二弹


    来自:http://www.jianshu.com/p/9ded120cb5d2

    (一)使用NavigationViewController进行页面跳转时,应该使用pushViewController方法来跳转至下一页面,这样的话,下一页面同样在NavigationViewController容器中。

    1、跳转到下一页面:

    PowerViewController*power = [[PowerViewControlleralloc] init];

    //所要跳转页面PowerViewController中有个属性dictionary1是个NSMutableDictionary类型的容器

    [power.dictionary1 setObject:[self.outTxtPass text] forKey:ALONE_SITEPRIZE_PWD];

    //使用pushViewController跳转到下一页面

    [self.navigationController pushViewController:power animated:YES];

    ?

    2、从当前页面返回到上一页面并传值过去:

    //此页面已经存在于self.navigationController.viewControllers中,并且是当前页面的前一页面

    PowerViewController*power= [self.navigationController.viewControllers objectAtIndex:self.navigationController.viewControllers.count-2];

    //初始化其属性

    power.dictionary = nil;

    //传递参数过去

    power.dictionary = [NSMutableDictionary dictionaryWithDictionary:self.dictionary1];

    //使用popToViewController返回并传值到上一页面

    [self.navigationControllerpopToViewController:poweranimated:YES];

    返回到上一页后,上一页面显示后要接收参数,并刷新。注意此时应该在viewDidAppear中进行判断并接收传递的值:

    -(void)viewDidAppear:(BOOL)animated

    {

    //判断并接收返回的参数

    }

    3、从当前页面返回到上一页面(无需传值)的方法:

    //返回到上一界面

    -(IBAction)backOff:(id)sender

    {

    [self.navigationController popViewControllerAnimated:true];

    }

    关于ios中 viewcontroller的跳转问题,其中有一种方式是采用navigationController pushViewController 的方法,比如我从主页面跳转到了一级页面,又从一级页面跳转到了二级页面,然后从二级页面跳转到了三级页面,依次类推。如果一级一级的返回我知道是没有问题的,调用navigationControllerpopViewControllerAnimated就行了。但是某些情况下我可能想要马上回到主页面,而不是一级一级的返回(如果有很多层会很累的),那该怎么办呢?

    1.返回根页面vc用

    [self.navigationController popToRootViewController]

    2.返回根页面vc用 :

    [self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:2] animated:YES];

    或(通过class定位)

    for(UIViewController *controller in self.navigationController.viewControllers) {

    if([controller isKindOfClass:[TargetControllerclass]]) {

    [self.navigationController popToViewController:controller animated:YES];

    }

    }

  • 相关阅读:
    Brain network involved in autonomic functions 与自主功能相关的大脑网络
    Brief summary of classical components of ERP 事件相关成分(ERP)经典成分小结
    ICA & Percentage Variance Account For (PVAF)
    数据处理中白化Whitening的作用图解分析
    Loadings vs eigenvectors in PCA 主成分分析(PCA)中的负荷和特征向量
    主成分分析(PCA)和独立成分分析(ICA)相关资料
    Sketch of heart and QRS complex 心脏及QRS波群简图
    Brain Network visulation in EEG 脑电网络可视化
    Phase Locking Value (PLV) 神经信号的锁相值
    ubuntu16.04下的一些基本操作笔记
  • 原文地址:https://www.cnblogs.com/qiyiyifan/p/6406464.html
Copyright © 2020-2023  润新知