Detect if iPhone screen is on/off

前端 未结 3 1708
醉话见心
醉话见心 2021-02-05 22:41

Is there any way to detect if an iPhone\'s screen is on or off? For example, when the phone\'s screen lock button is pressed.

I\'ve been using (void)applicationWi

3条回答
  •  暖寄归人
    2021-02-05 23:12

    Try this workaround. Author claims that it works well on 4.2

    I have checked it on iOS 3.1 (iPhone 3G) - works well.

    update: Doesn't work on iOS 5 beta 7 (iPod Touch 4G) :-(

    update2: app go to background when screen locked, thus solution is kinda working on iOS 5 beta 7 :-)

提交回复
热议问题