正如Apple文件中所述:
enum {
MPMusicRepeatModeDefault,
MPMusicRepeatModeNone,
MPMusicRepeatModeOne,
MPMusicRepeatModeAll
};
typedef NSInteger MPMusicRepeatMode;
然而,MPMusicRepeatModeDefault
被描述为用户首选的重复模式。由于我正在编写音乐播放器,我每次都需要知道当前的重复模式是什么,当返回时,“实际”模式是什么:
MPMusicRepeatModeNone
MPMusicRepeatModeOne
MPMusicRepeatModeAll
应该被选中?或者没有办法获得这些信息?
答案 0 :(得分:4)
我的理解是MPMusicRepeatModeDefault
仅用于实例化您自己的播放器here。
MPMusicPlayerController* appMusicPlayer = [MPMusicPlayerController applicationMusicPlayer];
// Use whatever the user has set in their iPod settings
// Omitting this line has no real effect because deferring to the
// user mode is the default setting for new players
[appMusicPlayer setRepeatMode: MPMusicRepeatModeDefault];
如果您想知道默认设置实际是什么,您应该可以从iPodMusicPlayer instance获取它:
MPMusicPlayerController* iPodMusicPlayer =
[MPMusicPlayerController iPodMusicPlayer];
MPMusicRepeatMode theDefaultMode = [iPodMusicPlayer repeatMode];