2011-04-29 24 views

回答

1

使用

self.tabBarController.selectedIndex = i; 

insted的的我给你写希望标签女巫的数量!

+0

helo ...我很抱歉它不工作,因为self.tabbarController.selectedindex = 1意味着它在相同的viewcontroller,但我需要带tabbar视图 – Ramz 2011-04-29 11:00:51

+0

你能解释你想要做什么? – 2011-04-29 11:03:25

+0

我需要做一个带有5个选项卡的TabBar控制器......并且相同的选项卡由一个包含5个按钮的窗口驱动....因此,主视图是5个按钮,当它选择时它将会选中相应的选项卡 – Ramz 2011-04-29 11:12:49

2

做这样的事情:

- (IBAction)selectSecondTab:(id)sender { 
    self.tabBarController.selectedIndex = 1; 
    [self.tabBarController.view setNeedsDisplay]; 
} 
0

变量分配给每个按钮在视图0,1,2,3,4和使用所有按钮同样的动作为

- (IBAction)selectTab:(id)sender 
{ 
    UIButton *button = (UIButton*)sender; 

    [self.tabBarController setSelectedIndex:[button tag]]; 

    [self.tabBarController.view setNeedsDisplay]; 
} 
相关问题