is there a notification when “slide to unlock” has occurred

戏子无情 提交于 2019-12-13 19:08:12

问题


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...)


回答1:


You could try viewWillAppear.




回答2:


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

This sent when your app becomes active

Another answer on SO applicable to your question:

applicationWillTerminate works as long as I don't switch off the iPhone



来源:https://stackoverflow.com/questions/1008595/is-there-a-notification-when-slide-to-unlock-has-occurred

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!