从 uiview 调用 PushViewController

发布于 2024-10-20 00:11:13 字数 749 浏览 5 评论 0原文

让我解释一下我的问题:

我有一个带有 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦纸 2024-10-27 00:11:13

我对此不太确定,但您可以尝试 super.navigationController 而不是 self
另外,从代码的外观来看,我认为它是一个设置视图。我建议您使用[selfpresentModalView:yourViewanimated:YES]。您可以查看 UIView 文档用于一系列动画。

I am not very sure about this but you could try super.navigationController instead of self.
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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文