使用 pushViewController: 动画: [英] Using pushViewController: animated:

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

问题描述

我正在尝试将 pushViewController:animated: 与 UIViewController 一起使用.我将它放在一个带有 initWithRoot 的 UINavigationController 中,但它仍然不起作用.

I'm trying to use the pushViewController: animated: with a UIViewController. I have it housed in a UINavigationController with initWithRoot and it still doesn't work.

这是我的代码?我做错了什么吗?

Here is my code? Am I doing something wrong?

CloudappSettingsViewController *cloud = [[CloudappSettingsViewController alloc] initWithNibName:nil bundle:nil];
        UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:cloud];
        [self pushViewController:nav animated:YES];
        [cloud release];

当它到达[self pushViewController:nav animation:YES];

有什么想法吗?谢谢

推荐答案

self"是一个 UINavigationController 吗?

is "self" a UINavigationController?

您似乎正在尝试推动导航控制器,但这是向后的.您应该展示导航控制器并向其推送其他视图.

It seems you are trying to push the navigation controller, but that is backwards. You should present the navigation controller and push additional views to it.

因此,您所在的 UIView 应该已经在导航控制器中,然后您可以将云推入其中.

So the UIView you are in should already be in the nav controller then you would push cloud into that.

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

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