简体   繁体   English

锁屏iPhone

[英]Lock-screen iPhone

My question is quite simple (I think and hope). 我的问题很简单(我认为并希望)。 I would like to know what happens when I lock my phone. 我想知道锁定手机后会发生什么。 I made a little clock-like app which should play and loop a sound at a given moment (lets say 18:00). 我制作了一个类似时钟的小应用程序,该应用程序应在给定的时间播放并循环播放声音(例如18:00)。 But when I press the power button, and the phone locks, nothing happens at 18:00. 但是,当我按下电源按钮并且手机锁定时,在18:00没任何反应。 When I press the power button again 18:05 and the "lock screen" shows, then the sound is played. 当我再次按电源按钮18:05并显示“锁定屏幕”时,将播放声音。

Please note, I didn't return to the home screen before locking the phone. 请注意,锁定手机之前我没有返回主屏幕。 The app is still open, when I unlock the app is shown. 当我解锁应用程序时,该应用程序仍处于打开状态。 Is there some way to let the app still do its thing eventhough I locked the screen? 即使我锁定了屏幕,是否可以通过某种方式让该应用程序继续执行其操作? Or is this just a programming error I might have made? 还是这只是我可能犯的编程错误?

Regards, Paul Peelen 问候,保罗·皮伦

You should take a look at information about the application delegate's applicationWillResignActive: and applicationDidBecomeActive: methods. 您应该查看有关应用程序委托的applicationWillResignActive:和applicationDidBecomeActive:方法的信息。 You can find this information in the iPhone Application Programming Guide. 您可以在《 iPhone应用程序编程指南》中找到此信息。 Also, take a look at information about "The Automatic Sleep Timer" in the same guide. 另外,请参阅同一指南中有关“自动睡眠计时器”的信息。

http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/ApplicationEnvironment/ApplicationEnvironment.html#//apple_ref/doc/uid/TP40007072-CH7-SW59 http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/ApplicationEnvironment/ApplicationEnvironment.html#//apple_ref/doc/uid/TP40007072-CH7-SW59

I think you can answer most of your own questions with this information but please post any follow up questions that you might have. 我认为您可以使用此信息回答大多数自己的问题,但请发布您可能遇到的任何后续问题。

Bart 巴特

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM