ios - 转到特定的标签栏 View

标签 ios xcode view controller

当我的应用程序启动时,我有 6 个 View Controller 。它就像一个图片库。例如,当用户按下第三个 View 上的按钮时,他/她应该进入选项卡栏中的第三个 View 。

我使用此代码启动选项卡栏 Controller 顶部的 View Controller :

- (void)viewDidAppear:(BOOL)animated {
    static BOOL first = YES;
    if (first) {
        UIViewController *popup = [[Home1ViewController alloc] initWithNibName:@"Home1ViewController" bundle:nil];

        [self presentViewController:popup animated:NO completion:nil];
        first = NO;
    }
}

通过使用这段代码关闭这个新 View ,我只是来到特定的 View ,而不是我的标签栏页面...

-(IBAction)dismissView {
    TabBarPage3 *screen = [[ TabBarPage3 alloc] initWithNibName:nil bundle:nil];
    screen.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
    [self presentModalViewController:screen animated:YES];
}

请帮帮我! 谢谢

最佳答案

这是在 TabBar 上改变 View 的代码

[((UITabBarController *)(self.parentViewController))setSelectedIndex:index];

Sample Project of UITabbar

关于ios - 转到特定的标签栏 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14327566/

相关文章:

ios - 有什么方法可以使用 AFNetworking Obj-C 获得纯 JSON 响应吗?

ios - libsqlite3.dylib 框架意外从 xcode 中删除

Mysql创建链接两个表的 View

android - setBackgroundResource 和 setBackgroundDrawable 有什么区别

ios - 以编程方式将 UIView 添加到 UITableView 的底部

iphone - AVPlayer是否可以像AVAudioPlayer的preparetoplay一样预缓冲音频?

ios - Swift - 多个 UI 更改相互阻塞

ios - 共享和运行 Xcode 项目不需要签名

xcode - 至于用TouchID来区分用户

ios - 如何在 iOS 的表格 View 中调整文本?