如何将"reset"下一个indexPath.row变为当前indexPath.row?

How to "reset" next indexPath.row to become current indexPath.row?

 -(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];

}

嗨 -- 我怎样才能 "reset" 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??

  }

谢谢!

如果您需要播放数组中的下一首曲目,则需要跟踪当前播放的曲目和该索引。你可以这样做:

- (IBAction)nextPressd:(id)sender
{
   self.selectedTrackRow += 1;
   self.nextTrack = self.SPTrackList[self.selectedTrackRow];
   [self playTrack:self.nextTrack];
}