Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在寻找一种在每次 Iphone 进入屏幕锁定模式时在 Iphone 屏幕上显示 UIAlert 的方法。
有没有办法通过本地通知而不使用计时器来做到这一点?还是有什么其他方式?有没有办法检测何时触发屏幕锁定?
提前致谢 ...
迈克迈克
没有操作系统指示屏幕即将锁定,至少对于有效的应用程序不可用。
如果用户锁定屏幕或设备自身锁定,您的应用程序委托的 applicationWillEnterBackground 方法将被调用,但我不相信您将能够从那里显示警报。