presentModalViewController与pushViewController [英] presentModalViewController vs. pushViewController

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

问题描述

我可以使用以下代码显示不同的视图:

I can show a different view with this code:

[self presentModalViewController:childView animated:nil];

这段代码应该做同样的事情,对吧?

This code should do the same thing, right?

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

但是它什么也没做。为什么?

But it doesn't do anything. Why is that?

推荐答案

pushViewController仅在导航控制器中有效

pushViewController only works in navigation controllers

presentModalViewController适用于所有视图控制器

presentModalViewController works for all view controllers

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

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