今天get到一种新的页面间反向传值的方式

    /*
    //get到新的一种传值方式
    for (UIViewController *controller in self.navigationController.viewControllers) {
        if ([controller isKindOfClass:[HomePageViewController class]]) {
            HomePageViewController *homepage = (HomePageViewController *)controller;
            homepage.leftItemTitle = city;
            [self.navigationController popToViewController:homepage animated:YES];
        }
    }
     */

拿到需要pop回的页面的对象,可以用上面的方式创建,如果知道在当前viewControlers数组中的下标也可以直接去数组中取,但是不能重新alloc创建,否侧会崩溃,提示找不到要返回的页面。

posted @ 2016-05-17 13:26  YouNeedCourage  阅读(158)  评论(0编辑  收藏  举报