iPhone 应用程序增加摇动手势灵敏度

标签 iphone objective-c uigesturerecognizer shake

在我的 iPhone 应用程序中,我使用了摇动手势,它可以正常工作,但需要很大的力气才能摇动。

有什么办法可以让它更灵敏吗?

这是代码

 - (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event
 {
      if (motion == UIEventSubtypeMotionShake)
      {
          [self performSelector:@selector(startPressed:)];  
      }
 } 

最佳答案

据我所知,这不是一种直接执行此操作的方法。

解决这个问题的一种方法是使用加速度计的读数,然后自行判断是否是震动,如果是的话,您可以自己微调。

关于iPhone 应用程序增加摇动手势灵敏度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9562168/

相关文章:

ios - 使用 Appdelegate 在 IOS Swift 中为所有 View Controller 创建 Firebase CRUD 方法

iphone - UITableView 在动画过程中崩溃,已找到解决方案,但没有找到根本原因,想知道为什么?

ios - 如何检查xcode中xctest案例中显示的警报 View

iPhone 应用程序崩溃 [__NSCFString objectForKey :] unrecognized selector sent to instance

ios - 使用手势识别器

iOS 应用程序 : access SMS and Call log

ios - 在 tableView 中重新加载数据时出现问题

ios - 以编程方式打开 Storyboard 中的特定页面

ios - 确定 CALayer 旋转了多少

ios - SKScene 中的 UIPanGestureRecognizer