gpt4 book ai didi

cocoa-touch - iOS 上 OpenFeint ScrollView 中的触摸问题

转载 作者:行者123 更新时间:2023-11-29 05:05:05 25 4
gpt4 key购买 nike

我到处寻找、询问,至今没有结果。我正在将 OpenFeint 放入一个游戏中,但 OpenFeint 仪表板中的 ScrollView 出现问题。排行榜和成就(以及其他当前不相关的其他)有 ScrollView ,并且在每个 View 中都可以滚动,但就好像它永远不会获得任何触摸结束事件。当您放手时,内容只会保留在原来的位置,即使它在 View 之外 - 它也不会反弹。当您再次触摸时,它会立即跳回来,并且可以再次滚动。

由此引起的更大问题是,您通常无法在 ScrollView 中选择任何内容(我猜它们是通过触摸结束事件选择的)。我可以通过两根手指的组合和大量的点击来选择内容,但实际上它不起作用。我知道这是我的应用程序的错误,因为它在示例应用程序中运行良好。

相关细节:该应用程序使用 SDL(1.3 的 git 快照,我必须自己编译并可以从中提供任何相关源代码)、OpenGL 和几乎全部 C++。我使用的是 OpenFeint 2.10(最新)、XCode 4.0.2(最新)和 iOS 4.3.2(在模拟器中;在我的实际设备上版本稍旧)。我想我做到了,这样游戏就不会在 OF 仪表板启动时检查事件,以防出现问题,但要么我失败了,要么没有效果。

这是模拟器中卡住的 ScrollView 的屏幕截图:
(来源:happyspork.com)

最佳答案

虽然this tutorial用于将 Cocos2D 与 Openfeint 集成,它解决了 OpenFeint 仪表板的输入出现乱码的类似问题:

Pay particular attention to the dashboardDidAppear and dashboardDidDisappear methods. You’ll see that we’re momentarily pausing the Cocos2D director and then re-enabling it once the dashboard disappears. This is a critical step cause otherwise it’s possible that input will be inconsistent or even not captured when the dashboard is displayed. But by pausing the director, we’re ensured that all user input is captured by the dashboard.

我不知道 SDL 是否有类似的“暂停”功能,但以类似的方式调用它可能会解决您的问题。

以下是该示例的相关代码:

- (void)dashboardDidAppear
{
[[Director sharedDirector] pause];
[[Director sharedDirector] stopAnimation];
}
- (void)dashboardDidDisappear
{
[[Director sharedDirector] resume];
[[Director sharedDirector] startAnimation];
}

关于cocoa-touch - iOS 上 OpenFeint ScrollView 中的触摸问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5711008/

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