gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-29 12:47:40 30 4
gpt4 key购买 nike

我有一个具有多层 (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/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com