开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜