本文介绍了当“滑动以解锁"时,是否有通知?已经发生了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用AVSoundPlayer播放背景音乐的iphone游戏-当有人锁定iphone时,音乐会停止,这很好.但是当有人解锁它时,当您盯着滑动解锁"屏幕时,我不希望我的音乐再次开始播放-我希望在您实际滑动按钮并且该应用可见后开始播放再次-有某种方法可以检测到这一点吗? (我尝试过applicationDidBecomeActive,但在手机解锁时会触发,但在您的应用可见时不会触发...)

I have an iphone game that plays background music using AVSoundPlayer - when someone locks the iphone the music stops which is fine. But when someone unlocks it, I don't want my music to start playing again while you're staring at the "slide to unlock" screen - I want it to start playing once you've actually slid the button and the app is visible again - is there some way to detect this? (I've tried applicationDidBecomeActive but that fires when the phone is unlocked but not when your app is visible yet...)

推荐答案

- (void)applicationDidBecomeActive:(UIApplication *)application;

此消息在您的应用激活时发送

This sent when your app becomes active

关于您的问题的另一种答案:

Another answer on SO applicable to your question:

applicationWillTerminate的工作原理为只要我不关闭iPhone

这篇关于当“滑动以解锁"时,是否有通知?已经发生了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 14:20