0

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.

4

1 に答える 1

0

トラックをテーブルに配置してトラックのタイトルを表示できる場合は、トラックがスター付きかどうかを示すのに十分なほどロードされているのでstarred、トラックのプロパティを確認するだけで済みます。

それ以外の場合は、次のことができます。

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;
    }
}];
于 2013-09-20T13:10:02.817 に答える