ios - 点击屏幕底部会导致 touchesBegan 延迟/延迟

标签 ios delay sprite-kit lag touchesbegan

我有一个具有多层 (SKNodes) 背景、游戏层、前景和 HUD 的场景,每个场景中都有多个 SKSpriteNode,用于滚动和您可以收集和点击的对象。

hud 层只有一个 SKSpriteNode(alpha 色)和几个 SKLabelNodes 用于得分和水平,点击屏幕上的任何地方(小得分区域除外)会导致即时 touchesBegan 事件触发(fab)但是.. . 在底部的微小 HUD 得分区域中点击会在触发 touchesBegan 之前引入滞后/延迟。

SKSpriteNode 或标签是否会捕获 touchesBegan 事件或其他事件并导致延迟?

我将创建一个简化的项目来测试它并发布我的发现,但我认为如果这个问题/查询得到回答可能会对其他人有所帮助。谢谢。

这是最接近我的问题的帖子,但我的应用程序委托(delegate)中没有任何手势识别器。 Sprite Kit touchesbegan: delay/lag

最佳答案

我尝试将得分面板(SKSpriteNode 和标签)从屏幕底部移开并触摸它们不再产生延迟。 (所以不是他们!)

点击屏幕底部仍然会导致延迟。

我可以确认 LeanCocos2D 关于控制中心导致延迟的建议是正确的。请参阅官方 IOS7 UI 指南的摘录:

Expect users to swipe up from the bottom of the screen to reveal Control Center. If iOS determines that a touch that begins at the bottom of the screen should reveal Control Center, it doesn’t deliver the gesture to the currently running app. If iOS determines that the touch should not reveal Control Center, the touch may be slightly delayed before it reaches the app.

https://developer.apple.com/library/ios/documentation/userexperience/conceptual/transitionguide/Scoping.html

为了解决这个问题,因为我确实需要人们能够在我的屏幕底部快速响应点击,因此在 ViewController 中包含以下代码:

- (BOOL) prefersStatusBarHidden
{
    return YES;
}

我真的希望这对您有所帮助。

关于ios - 点击屏幕底部会导致 touchesBegan 延迟/延迟,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23241477/

相关文章:

ios - TableView 项目应该加载另一个 TableView

C# 自定义 Invoke 方法调用各种其他方法

jquery - jquery代码错误

swift - 将一个 SKSpritenode 移向另一个 SKSpriteNode(磁铁)

swift - 如果分数增加,为什么我的 SKLabelNode 会离开页面

android - 我可以为 android 和 ios 加密我的源代码吗?

android - 是否需要任何配置来使用 Android 和 IOS 的 Web Api 服务(为黑莓开发)

android - Dart/Flutter - 调用/执行存储在属性的字符串变量中的方法

flash - Flash/ActionScript 3声音延迟

ios - 来自 SKEmitterNode 的动画粒子