ios - iPad 不检测摇动事件

标签 ios ipad ios-simulator motion shake

模拟器可以毫无问题地检测到抖动事件。当我在物理设备 (iPad 2) 上运行该应用程序时,没有任何反应。我开始怀疑自己是否知道如何摇晃它......

我想我已经做了所有必要的事情:

-(BOOL)canBecomeFirstResponder{
    return YES;
}

在 View 上调用becomeFirstResponder

我已经实现了:

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

您有什么建议吗?为什么它在模拟器上运行而设备上没有任何反应?

这个问题很像我的情况:Shake Motion events not working但这对我帮助不大。

最佳答案

我已经找到并“解决”了我的问题。

设备应设置为 iPad 或 Universal,以便 iPad 检测到摇动 Action 。这可能很明显(但显然我已经错过了)......我只想制作一个示例应用程序,但我忘记将默认设置从“iPhone”更改为“iPad”。

enter image description here

关于ios - iPad 不检测摇动事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15742769/

相关文章:

android - 移动应用程序(iPhone/Android)应用程序从相机读取实时文本

iOS 7.1 UitableviewCell 内容与下面的重叠

iphone - 设置默认的 UIScrollView 比例

ios7 - 新的 Xcode 6 项目 - 如何在 iOS 7 模拟器中运行

directory - Xcode模拟器中的app content文件夹在哪里?

ios - 更好地理解 NSURLConnection 和 NSOperationQueue

ios - 简单的 stringByReplacingOccurrencesOfString 帮助问题

ios - 无法使用 XCode 9 测试 iOS 10 (iphone 5) 模拟器

ios - 从其他 View 更新 UIButton 标题...?

ios - 如何正确子类化 UIActionSheet