My application contains an NSTabView
with two tabs. Further, the application itself has a playState
which is an enum. The playState
is kept in a Singleton.
typedef enum {
kMyAppPlayStatePlaying,
kMyAppPlayStatePaused
} MyAppPlayState;
The playState
gets synthesized here.
@property (readwrite) MyAppPlayState playState;
I want to switch the NSTabView
every time the playState
changes. Therefore, I prepared an IBOutlet
to add a binding similar to this one.
[self.playPauseTabView bind:@"selectedItemIdentifier" toObject:[MyAppState sharedState] withKeyPath:@"playState" options:nil];
I already recognized the identifier
must be NSString
. This does not match with my enum which is an int
. I could maybe use an NSValueTransformer
to fix this.
Further, selectedItemIdentifier
does not exists. NSTabView
only offers selectedTabViewItem
which then allows to access identifier
or label
. Though, I cannot find a way to switch the item itself based on the identifer.