You have used wrong method.
- (void)tabBar:(NSTabView *)tabBar didSelectItem:(NSTabViewItem *)item
Instead it should be
- (void)tabView:(NSTabView *)tabView didSelectTabViewItem:(NSTabViewItem *)tabViewItem
This is very straight forward.
Hook the NSTabView
to the AppDelegate
for delegate. (Be sure that you hook correctly to the TabView itself not its parts)
Then check for the Identifier and Label for each of the tabs:
Then the delegate method goes like this:
- (void)tabView:(NSTabView *)tabView didSelectTabViewItem:(NSTabViewItem *)tabViewItem{
if ([tabViewItem.identifier isEqualToString:@"1"]){
NSLog(@"ONE");
}
else{
NSLog(@"TWO");
}
}