2012-09-10 73 views
1

我正在构建基本应用程序。它使用3个视图的标签栏。我在第一个视图上有一个按钮。当我点击它时,我希望它切换到第三个视图,但将标签栏保留在底部。现在,我有它的工作,但是当它切换到第三视图,我失去了标签栏。切换视图失去选项卡栏

我是新来的,所以对我来说很容易。我试图在这个网站搜索,但没有任何帮助完全。如果可能的话,请提供代码以及应该使用哪些文件。

在我.hi把这个代码: -(IBAction) btnClickedSell1:(id) sender;

在的.mi把这个代码:

-(IBAction) btnClickedSell1:(id) sender { 
    Selling *second = [[Selling alloc] initWithNibName:nil bundle:nil]; 
    [self presentModalViewController:second animated:YES]; 
} 

我相信,我必须有正确的代码,但是我不知道哪个文件他们应该进入准确的步骤和采取IB的确切步骤。

任何帮助,非常感谢!

回答

0

你不应该使用presentModalViewController:animated,如果你只是想切换到第3个观点,我认为你应该试试这个代码:如果您的应用程序是基于的TabBar

[yourTabBarController setSelectedIndex:2]; 

您可以通过NSApplicationDelegate得到yourTabBarController应用。

+0

谢谢你的帮助。你能帮我重写一下我需要的东西吗? - (IBAction)btnClickedDone:(id)发送者{0}第一视图控制器*第二视图= [[FirstViewController alloc] initWithNibName:nil bundle:nil]; \t [self presentModalViewController:second animated:YES]; – mreynol

0

在基于选项卡的应用程序中,每个bar按钮的作用与ViewController相似。所以你可以重定向到下一个ViewController你不能保留你的第一个Bar按钮。

相关问题