如何为tabless NSTabViewController选择选项卡

时间:2018-05-17 11:50:05

标签: objective-c cocoa nstabview nstabviewcontroller

我创建了示例NSTabViewController项目 我添加了带有3个标签项的标签View Controller。 然后我将tabview设为少标签,并在三个按钮的帮助下切换标签 我在主视图控制器中执行了按钮动作 我正在使用

选择标签
[tabController setSelectedTabViewItemIndex:tag];
//tabController is NSTabController and Tag is selected tab index

问题:选项卡选择不随按钮而变化。

1]

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];
}

0 个答案:

没有答案