简体   繁体   English

区分iOS中的单击和双击主页按钮

[英]differentiate between single click and double click on Home button in iOS

I want to handle single click and double click on Home button separately. 我想分别处理单击和双击“主页”按钮。 I know applicationWillResignActive: but it gets call in both conditions. 我知道applicationWillResignActive:但它在两种情况下都会被调用。 applicationDidEnterBackground: but I want to process data before app goes in background not after. applicationDidEnterBackground:但是我想在应用程序进入后台之前处理数据,而不是之后。

Is there any way I can recognise single and double click on home button separately? 有没有什么办法能够单独地识别双击 home键?

Nope. 不。 You can only see when your app enters the background (or terminates). 您只能看到您的应用何时进入后台(或终止)。 You can't see why . 你不明白为什么

when application in running single click will call 当应用程序在运行中单击时将调用

  • applicationwillresigned 申请将被辞职
  • applicationDidEnterBackground applicationDidEnterBackground

but double click will call only 双击只会致电

  • applicationwillresigned 申请将被辞职

and will wait for your response. 并等待您的回复。

you can use bool to figure out whether it is double or single click 您可以使用布尔值来确定是双击还是单击

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

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