views:

30

answers:

1

i have 2 tab buttons with Nib files.... and i have a button on tab1 ..on pressing it i want to show tab 2's view (not click on tabbar button2)..means i want to click second tabbar button through programming...

how can i do it ....is it possible ?

+2  A: 

You'll have to create a function with this in it:

[self.tabBarController setSelectedIndex:1];

So eg:

- (void)selectNextTabBarView:(id)selector {
  [self.tabBarController setSelectedIndex:1];
}

and then on your button you need:

[myButton addTarget:self action:@selector(selectNextTabBarView:) forControlEvents:UIControlEventTouchUpInside];
Thomas Clayson
bravo man thank a lot....voted and accepted..
Ranjeet Sajwan
much obliged. :)
Thomas Clayson