Problems with touches in OpenFeint scroll views on iOS
I've been searching and asking everywhere, so far to no av开发者_运维百科ail. I've got a game which I'm putting OpenFeint into, and I'm having issues with the scroll views in OpenFeint's dashboard. There's scroll views for Leaderboards and Achievements (and others that aren't currently relevant), and in each of them, it's possible to scroll, but it's as though it never gets any touch ended events. When you let go, the content just stays where it was, even if it's outside the view - it doesn't bounce back. When you touch again, it jumps back instantly, and is scrollable again.
The bigger problem caused by this though, is that you can't normally select anything in the scroll views (I guess they're selected with a touch ended event). I was able to select things with some combination of two fingers and lots of tapping, but practically it doesn't work. And I know it's the fault of my app, because it works fine in the sample app.
Pertinent details: the app uses SDL (a git snapshot from 1.3, which I had to compile myself and can provide any relevant source from), OpenGL, and almost entirely C++. I'm using OpenFeint 2.10 (newest), XCode 4.0.2 (newest), and iOS 4.3.2 (in the simulator; slightly older versions on my actual devices). I think I made it so the game wasn't checking for events while the OF dashboard was up in case that was the problem, but either I failed, or it had no effect.
Here's a screenshot of a stuck scroll view in the simulator:
(source: happyspork.com)Although this tutorial is for integrating Cocos2D with Openfeint, it addresses a similar issue where input to the OpenFeint dashboard gets garbled:
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.
I do not know if SDL has a similar "pause" function, but calling that in a similar way may address your issue.
Here is the relevant code from that example:
- (void)dashboardDidAppear
{
[[Director sharedDirector] pause];
[[Director sharedDirector] stopAnimation];
}
- (void)dashboardDidDisappear
{
[[Director sharedDirector] resume];
[[Director sharedDirector] startAnimation];
}
In case anyone else has this problem, this link essentially fixed it for me: http://forums.libsdl.org/viewtopic.php?t=5678&sid=99aa9531656e0aa398ce35a7c348fe88
So far it has not fixed the scrolling issue, but it did fix the selecting issue, which is the main one. And perhaps the other one can be fixed with some fiddling.
精彩评论