I would like to link a tab of a OS X Cocoa Tab View to a specific action, but ctrl+drag doesn't work.
I found an other post of somebody that had about the same problem than I do, but it was on iOS and I am failing to adapt this to OS X. I don't understand if I am failing because I am not using the good functions or if it is for another reason.
Here is what I am doing when trying to adapt the method given on the other post :
First, I ctrl+drag from the Tab View to "File's Owner" and make it the delegate of this.
Then, I add this code to AppDelegate.h :
- (void)tabBar:(NSTabView *)tabBar didSelectItem:(NSTabViewItem *)item
And on AppDelegate.m :
- (void)tabBar:(NSTabView *)tabBar didSelectItem:(NSTabViewItem *)item
{
if([item.identifier isEqualTo:@1])
{
NSLog(@"Click !");
}
}
The identifier of my tab "Apprendre" is 1.
The problem is that when I run this code, nothing appears in the console when I click on the "Apprendre" tab. Do you know where I am wrong ?