【问题标题】:Is it possible to make iOS to detect custom gesture/motion at background?是否可以让 iOS 在后台检测自定义手势/动作?
【发布时间】:2015-06-02 18:52:03
【问题描述】:

iOS 确实提供了用于其抖动运动检测的功能。

- (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event ;

但我有自定义手势,例如 WAVE 等。我尝试使用 motionBegan,但结果看起来非常糟糕。 AKA,您需要先摇动手机才能触发此功能。我想知道,有没有更好的解决方案,

【问题讨论】:

    标签: ios gesture-recognition motion


    【解决方案1】:

    您可以使用 Core Motion 框架来检测设备的定向/加速方式。对于自定义手势,您必须编写代码来确定正在发生的事情是否是您的手势。这一点都不容易。我在这里举了一个非常简单、相当人为的例子,我检测到(有一些延迟)手机正被侧向拍到用户张开的手掌中:http://www.apeth.com/iOSBook/ch35.html#_raw_acceleration

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-12-05
      • 1970-01-01
      • 2017-03-07
      • 2011-05-15
      • 1970-01-01
      • 2011-08-17
      • 2020-08-30
      相关资源
      最近更新 更多