I want to use a NSLevelIndicator
to manage ratings in my apps but I don' t understand how to detect click on it and update the ratings.
This is the code: the property rate
is created in the .h file and it's an IBOutlet correctly linked in IB.
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
NSLevelIndicatorCell *cell = [[NSLevelIndicatorCell alloc] initWithLevelIndicatorStyle:NSRatingLevelIndicatorStyle];
[cell setMinValue:0.0];
[cell setMaxValue:5.0];
[cell setFloatValue:3.0];
[cell setTarget:self];
[cell setAction:@selector(click:)];
[self.rate setCell:cell];
}
- (IBAction)click:(id)sender
{
//How to detect change in rating here???
}
I post the solution for other people with the same "issue".
The reason why the user interaction not works for me is because i need to call [cell setEnabled:YES]
.
Probably this property is set to NO
by default.