如何在MPMusicPlayer上控制下一曲目项

时间:2010-11-30 11:16:21

标签: iphone

在MPMusicPlayer中,如果Next Track项目完成,我想显示MPMediaPickerView .... 这怎么可能在手机上....请帮助我....

1 个答案:

答案 0 :(得分:0)

关注MPMusicPlayerControllerNowPlayingItemDidChangeNotification,并在selector方法中查看playbackState MPMusicPlaybackStateStopped,进行其他检查(可能是nowPlayingItem?),然后在你的观点。

NSNotificationCenter * notifications = [NSNotificationCenter defaultCenter];
    [notifications addObserver:self selector:@selector (trackDidChangeWithNotification:)
                          name:MPMusicPlayerControllerNowPlayingItemDidChangeNotification
                        object:self.iPodController];

.....

-(void)handleNextTrackNotification {
    if ([self.iPodController playbackState] == MPMusicPlaybackStateStopped) {
        // do whatever logic checks
        // present view
    }
}