iOS: How to get my audio app to register in the multitask controls?
When a user double clicks the home button and swipe r开发者_高级运维ight, some audio controls shows. How do I get use them? I've searched but havn't found anything that helps me.
Try this
- (void) remoteControlReceivedWithEvent: (UIEvent *) receivedEvent {
switch (receivedEvent.subtype) {
case UIEventSubtypeRemoteControlTogglePlayPause:
[self playTapped];
break;
case UIEventSubtypeRemoteControlPreviousTrack:
[self previousTapped];
break;
case UIEventSubtypeRemoteControlNextTrack:
[self nextTapped];
break;
default:
break;
}
PlayTapped is the method for playing the music. nextTapped is the method for the next song to be played. previousTapped is for playing the previous track.
All the best
精彩评论