objective-c - 用于更改 View 的按钮的代码(使用 TabBarController)

标签 objective-c ios uinavigationcontroller uitabbar

我有一个带有 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/

相关文章:

ios - 如果从 nib 加载,则 UITableViewCell 框架与 Storyboard 加载有所不同

ios - TPKeyboardAvoidingScrollView 在 subview (UITextView) 扩展时不扩展

ios - 无法将使用代码创建的 socket 连接到静态单元格

ios - 使用基于页面的导航将数组数据从一个界面传递到 watchkit 中的另一个界面?

iphone - UITabBar 中的单个选项卡不包含 UINavigationBar

ios - 如何在 iOS 9 中使用 Swift 从 CMSampleBuffer 中提取像素数据进行处理?

objective-c - 嵌入式 NSArray 中第一个元素的键路径

ios - 从 Storyboard中的 UIViewController 加载 UIView 不起作用

objective-c - 如何使大纲 View 中的文本单元格显示父行有多少个子行?

ios - 使用 instantiateViewControllerWithIdentifier 但不使用 performSegueWithIdentifier 时出现延迟?