如何从uiviewcontroller跳转到tabbarcontroller?

问题描述:

我有一个ViewController作为初始视图控制器和TabbarController。视图控制器上有3个按钮,TabbarController有3个选项卡。 我想点击第一个按钮跳转到第一个标签,第二个按钮 - 第二个标签等 我应该怎么做?我正在与故事板如何从uiviewcontroller跳转到tabbarcontroller?

请澄清你的问题,如果你只是想要移动你的标签点击按钮使用selectedatindex方法的标签栏。

+0

对不起我的英语>进口AppDelegate类)我想去从ViewController – Romowski 2013-02-18 04:51:12

试试这个,

第1步 - 在ViewController.m

#进口 “AppDelegate.h”

- (IBAction) BtnOneClicked: (id) sender 
{ 
    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate]; 
    [appDelegate.tabBarController setSelectedIndex:0]; 
} 
- (IBAction) BtnTwoClicked: (id) sender 
{ 
    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate]; 
    [appDelegate.tabBarController setSelectedIndex:1]; 
} 
- (IBAction) BtnThreeClicked: (id) sender 
{ 
    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate]; 
    [appDelegate.tabBarController setSelectedIndex:2]; 
} 
+0

TabBarController某些选项卡不行动,不幸的是 可能是我的错误在我的AppDelegate didFinishLaunchingWithOptions? – Romowski 2013-02-18 05:43:19

+0

在您的xcode中简单地创建tabbar应用程序,并在您的firstViewController中创建3个按钮,将其放在代码 – Ravindhiran 2013-02-18 07:18:34

+0

之上不! ViewController必须在TabBarController 这里http://dfiles.ru/files/cqsc8h5hz你可以看到我想要做的) – Romowski 2013-02-18 09:25:19