0

让我解释一下我的问题:

我有一个带有 2 个 UIViews 的 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 中。

有人可以解释一下发生了什么吗?

谢谢

4

1 回答 1

0

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.

于 2011-03-02T19:11:15.120 回答