我创建了示例NSTabViewController
项目
我添加了带有3个标签项的标签View Controller。
然后我将tabview设为少标签,并在三个按钮的帮助下切换标签
我在主视图控制器中执行了按钮动作
我正在使用
[tabController setSelectedTabViewItemIndex:tag];
//tabController is NSTabController and Tag is selected tab index
问题:选项卡选择不随按钮而变化。
SSTabViewController *tabController = (SSTabViewController*) [self getController:@"SSTabViewController" WithStoryBoard:@"Main"];
selectedTabIndex = sender.tag;//i have set tags to buttons
[tabController setSelectedTabViewItemIndex:selectedTabIndex];
-(id) getController:(NSString*) controllerIdentifier WithStoryBoard:(NSString*) storyboradName
{
NSStoryboard *storyboard = [NSStoryboard storyboardWithName:storyboradName bundle:[NSBundle mainBundle]];
return [storyboard instantiateControllerWithIdentifier:controllerIdentifier];
}