-1
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellId = @"cellid";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId forIndexPath:indexPath];
songs = [MPMediaQuery songsQuery];
songsArray = [songs items];
MPContentItem *item = [songsArray objectAtIndex:indexPath.row];
cell.textLabel.text = [item valueForKey:@"title"];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
MPContentItem *item = [songsArray objectAtIndex:indexPath.row];
if ([self.AudioPlayer isPlaying]) {
[self.AudioPlayer pause];
}else if(![self.AudioPlayer isPlaying]){
NSError *error;
self.AudioPlayer = [[AVAudioPlayer alloc]initWithContentsOfURL:[item valueForKey:MPMediaItemPropertyAssetURL] error:&error];
[self.AudioPlayer play];
}