- NSMenu *ratingSubmenu = [[NSMenu alloc] initWithTitle:@""];
- unichar whiteStar = 'o';//2606;
- unichar blackStar = 'x';//2605;
- NSString *whiteStarString = [NSString stringWithCharacters:&whiteStar
- length:1];
- NSString *blackStarString = [NSString stringWithCharacters:&blackStar
- length:1];
- NSString *string = @"";
- int i;
-
- for (i = 0; i < 5; i++) {
- string = [string stringByAppendingString:whiteStarString];
- }
- for (i = 0; i < 6; i++) {
- NSMenuItem *ratingItem;
- ratingItem = [ratingSubmenu addItemWithTitle:string action:@selector(setSongRating:) keyEquivalent:@""];
- [ratingItem setTarget:self];
- [ratingItem setTag:i * 20];
- string = [string substringToIndex:4];
- string = [blackStarString stringByAppendingString:string];
- }
- [[menu addItemWithTitle:@"Song Rating"