简体   繁体   English

iOS双击主页按钮事件

[英]ios double click home button event

Is there anyway to capture double click home button event. 无论如何,有捕获双击主页按钮事件。

I know it will run into applicationWillResignActive, but there are many situations that application will run into applicationWillResignActive so I can NOT distinguish the double click home button event with other events. 我知道它将运行到applicationWillResignActive中,但是在很多情况下应用程序将运行到applicationWillResignActive中,因此我无法将双击主页按钮事件与其他事件区分开。

Can anybody give me some hints? 有人可以给我一些提示吗?

My app is meeting a bug: - On iOS 7, when double click home button, you can see running app with their current images. 我的应用程序遇到一个错误:-在iOS 7上,双击主页按钮,您可以看到正在运行的应用程序及其当前图像。 Because my app have some protection (I built a passcode view), so when user home button or double click home button, I will capture event to show my passcode view first. 因为我的应用程序具有一定的保护功能(我构建了密码视图),所以当用户使用主页按钮或双击主页按钮时,我将捕获事件以首先显示密码视图。 To do this, I place my code to show passcode on applicationWillResignActive. 为此,我将代码放置在applicationWillResignActive上以显示密码。

  • It works well, but another problem occurs, when user pull down notification or other action make app resign active, it will show my passcode view, this lead user feel very annoy. 它运作良好,但是出现另一个问题,当用户下拉通知或其他操作使应用程序退出时,它将显示我的密码视图,这使用户感到非常烦恼。 So I just want to show passcode view whenever user home button or doubleclick home button. 所以我只想在用户主页按钮或双击主页按钮时显示密码视图。 Does anyone have any idea? 有人有什么主意吗?

No there is not. 不,那里没有。

Apple just don't allow you to access their hardware. Apple只是不允许您访问其硬件。 The only thing you can do is to use frameworks to accsess those hardware. 您唯一可以做的就是使用框架来控制那些硬件。 If there isn't any framework for that, there is just no way to do this without coding for jailbreak or something. 如果没有任何框架,那么没有编码越狱之类的东西就没有办法。

You can think about layers of the software. 您可以考虑软件的各个层。

  1. Hardware independent = Like apps 独立于硬件=喜欢应用
  2. Hardware using = For Example Camera Apps (Using some type of core Frameworks) 硬件使用=例如Camera Apps(使用某种类型的核心框架)
  3. Hardware itself = NO permission to use that layer 硬件本身=没有使用该层的权限

The core frameworks give you the closes freature to code for the hardware. 核心框架为您提供了编写硬件代码的基础。

IOS Frameworks IOS框架

You can't access any button clicks on the home button. 您无法访问主页按钮上的任何按钮单击。

When it goes into applicationWillResignActive that's as a secondary result of the button click. 当它进入applicationWillResignActive ,这是按钮单击的次要结果。 Not a direct result. 不是直接的结果。

ie the button is clicked, the OS interprets the click, then tells your app to go into background, then you get applicationWillResignActive . 即单击按钮,操作系统解释该单击,然后告诉您的应用进入后台,然后您获得applicationWillResignActive

Same when you receive a phone call etc... 收到电话等时也是如此...

There's no way of specifically detecting a double tap on the home button. 无法专门检测主页按钮上的双击。

As you note, you should respond to applicationWillResignActive . 如您所述,您应该响应applicationWillResignActive

What are you actually trying to achieve? 您实际上想达到什么目的?

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

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