Je peux afficher la bibliothèque musicale sur UITableView.Lecture de musique lorsque je sélectionne UITableViewCell
songsArray = [[NSMutableArray alloc]init];
MPMediaQuery *playlistQuery = [[MPMediaQuery alloc]init];
[playlistQuery setGroupingType:MPMediaGroupingTitle];
songArray = [playlistQuery items];
for (MPMediaItem *song in songArray) {
NSString *songTitle = [song valueForProperty: MPMediaItemPropertyTitle];
[songsArray addObject:songTitle];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath {
cell.textLabel.text = [songsArray objectAtIndex:row];
[cell.textLabel setTextColor:[UIColor whiteColor]];
Mais je ne peux pas lire de musique lorsque j'ai sélectionné UITableView Cell.
NSUInteger row = indexPath.row;
NSString *selectedSong = [songsArray objectAtIndex:row];
MPMusicPlayerController *appPlayer = [MPMusicPlayerController iPodMusicPlayer];
[appPlayer setQueueWithQuery:selectedSong];
[appPlayer play];
}
Qui peut me aider?
Est-ce que le travail de MPMusiePlayerController sans tableView, si vous manuellement sel ect une chanson? –
Oui, je sélectionne une chanson sans MediaPicker. – Sookcha
Je vais choisir une chanson comme le lecteur de musique par défaut de l'iPhone (iPod) – Sookcha