从 uiview 调用 PushViewController
让我解释一下我的问题:
我有一个带有 2 个 UIView 的 UIViewController 。 我的 UIView 中有一个按钮,我从 UIViewController 调用一个方法。
[controller actionMainSettings];
这就是方法:
-(void)actionMainSettings{
MainSettings *mainController = [[MainSettings alloc] initWithNibName:@"MainSettings" bundle:nil];
[self.navigationController pushViewController:mainController animated:YES];
[[self navigationController] setNavigationBarHidden:YES animated:NO];
[mainController release];
}
MainSettings 是一个 UIVewController...
并且没有任何反应...
当我将按钮放入 UIVIewController ([self.view addSubview:buttonSettings];
) 中时,没关系,但我想要将其放入另一个 UIView 中。
有人可以解释一下发生了什么吗?
谢谢
let me explain you my problem:
I have an UIViewController with 2 UIViews.
I have a button in one of my UIView and i call a methode from my UIViewController.
[controller actionMainSettings];
And this is the methode:
-(void)actionMainSettings{
MainSettings *mainController = [[MainSettings alloc] initWithNibName:@"MainSettings" bundle:nil];
[self.navigationController pushViewController:mainController animated:YES];
[[self navigationController] setNavigationBarHidden:YES animated:NO];
[mainController release];
}
MainSettings is an UIVewController...
and nothing happen...
When i put my button in my UIVIewController ([self.view addSubview:buttonSettings];
) it's ok but i want to put it in another UIView.
Can someone explain me what happen?
thx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我对此不太确定,但您可以尝试
super.navigationController
而不是self
。另外,从代码的外观来看,我认为它是一个设置视图。我建议您使用
[selfpresentModalView:yourViewanimated:YES]
。您可以查看 UIView 文档用于一系列动画。I am not very sure about this but you could try
super.navigationController
instead ofself
.Also, from the look of your code, I would assume it's a settings view. I would recommend that you use
[self presentModalView:yourView animated:YES]
. You can look at the UIView documentation for a range of animations.