2013-03-19 53 views
0

我想使用NSLevelIndicator來管理我的應用中的評分,但我不明白如何檢測點擊並更新評分。NSLevelIndicator:檢測點擊和更新

這是代碼:屬性rate在.h文件中創建,它是IB中正確鏈接的IBOutlet。

- (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??? 

} 

回答

1

我張貼其他人同樣的 「問題」 的解決方案。

用戶互動不適合我的原因是因爲我需要撥打[cell setEnabled:YES]。 默認情況下,此屬性可能設置爲NO

0

也許這是一個錯誤,但setEnabled:不解決任何問題,而setEditable:做。