交换 presentModalViewController 和 pushViewController [英] Interchanging presentModalViewController and pushViewController

查看:63
本文介绍了交换 presentModalViewController 和 pushViewController的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用示例程序中显示的示例 ViewController 作为presentModalViewController.但是,我想在 UIViewController 上使用 pushViewController .问题是当我切换到 pushViewController 时,ViewController 没有正确显示.调用了 ViewController 中的函数,但我什么也没看到.我改回presentModalViewController,一切正常.

I am using a sample ViewController that is displayed in the sample program as a presentModalViewController. However, I want to use pushViewController on the UIViewController instead. The problem is that when I switch to pushViewController, the ViewController no displays properly. Functions in the ViewController are called, but I don't see anything. I change back to presentModalViewController and everything works.

问题是我需要做什么才能使 pushViewController 工作?

The question is what do I need to do to make pushViewController work?

FCVC *fcVC;  
NSArray *array = [[NSBundle mainBundle] loadNibNamed:@"fcVC" 
                                               owner:self     
                                             options:nil];  
fcVC = [array objectAtIndex:0];  

A.[self presentModalViewController:fcVC animation:YES];//"WORKS"

B. [self.navigationController pushViewController:fcVC animation:YES];//"不起作用

A. [self presentModalViewController:fcVC animated:YES]; // "WORKS"
or
B. [self.navigationController pushViewController:fcVC animated:YES]; // "Doesn't work

推荐答案

你真的设置了 UINavigationController 吗?self"应该是一个加载到 UINavigationController 中的 viewController.

Do you have a UINavigationController actually set up? "self" should be a viewController that is loaded inside UINavigationController.

这篇关于交换 presentModalViewController 和 pushViewController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆