我有一个带有 TabBarController 的基本应用程序。我有三个选项卡,它们都有 .xib 文件,每个选项卡都会加载这些文件。每个选项卡还有一个 NavigationbarController,因此它有一个顶部带有标题的导航栏。 现在我想制作一个按钮(实际上每个选项卡上都有一个,没关系),它加载另一个 View (它应该翻转过来,但现在也没有关系)。如何编码? 我已经有了这段代码,但是每个类的窗口都有问题(我也不知道将它放在哪个操作中。):
- (void)flipToBack {
OptionsViewController *optionsView= [[OptionsViewController alloc] initWithNibName:@"OptionsView" bundle:nil];
[self setSecondViewController:optionsView];
[optionsView release];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:2.0];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:window cache:YES];
[viewController (?).view removeFromSuperview];
[self.window addSubview:[OptionsViewController view]];
[UIView commitAnimations];
OptionsViewController 是我的 OptionsView 的 .h 和 .m 文件。 ViewController 是我卡住的地方。我应该把什么 Controller 放在那里?另外:我应该把它放在哪个文件中? (大概在现在看来),我就卡在这里了。
我的观点如下:
-View
-TabBar
-Navigation Bar
-TabBar item
-NavigationBar Button
-View controller
-Navigation Bar
-TabBar item
-NavigationBar Button
-View controller
-Navigation Bar
-TabBar item
-NavigationBar Button
-View controller
最佳答案
你想过渡到一个全新的 View / View Controller 吗?如果是这样,请尝试 - (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated 在您的导航 View Controller 中。
关于objective-c - 用于更改 View 的按钮的代码(使用 TabBarController),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5771583/