I want to add an option to my spotify application which using Cocoalibspotify (iOS) that will mark all the Starred song with some image that i'v made, the problem is that: for checking if SPTrack is starred or not i should load the track using SPASYNCLOADING method which returns void. so basically for each cell on the table i will take the spotify ID and load the track to know if the track is starred or not. I wanted to know if there is another way to do it ? since on those SPASYCNLOADING methods you can't return value.
Asked
Active
Viewed 45 times
1 Answers
0
Well, if you're able to put the tracks into a table and have the track's title show up, the track is loaded enough to show whether it's starred or not, so you can just check the starred
property of the track.
Otherwise, you could do:
UITableViewCell *cell = …;
SPTrack *track = …;
[SPAsyncLoading waitUntilLoaded:track timeout:kSPAsyncLoadingDefaultTimeout then:^(NSArray *loadedItems, NSArray *notLoadedItems) {
if (notLoadedItems.count > 0) {
// Track didn't load, so bail out.
return;
}
if (track.starred) {
cell.imageView.image = [UIImage imageNamed:@"starred"];
} else {
cell.imageView.image = nil;
}
}];

iKenndac
- 18,730
- 3
- 35
- 51