-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
self.selectedTrack = self.SPTrackList[indexPath.row];
self.selectedTrackRow = indexPath.row;
self.nextTrack = self.SPTrackList[indexPath.row +1];
[self playTrack:self.selectedTrack];
}
嗨 - 我怎样才能"重置" self.nextTrack成为self.selectedTrack?我已经尝试过self.nextTrack = self.selectedTrack,但这只会工作一次。我猜我需要遍历 - 如果那是正确的话 - 并且将self.selectedTrack和self.nextTrack的indexPath向前移动?
- (IBAction)nextPressd:(id)sender {
[self playTrack:self.nextTrack];
//self.nextTrack now be new self.selectedTrack via indexPath.row??
}
谢谢!
答案 0 :(得分:0)
如果您需要播放阵列中的下一首曲目,则需要跟踪当前播放曲目和该索引。你可以这样做:
- (IBAction)nextPressd:(id)sender
{
self.selectedTrackRow += 1;
self.nextTrack = self.SPTrackList[self.selectedTrackRow];
[self playTrack:self.nextTrack];
}