Reputation: 129
I am having trouble using a uiscrollview with cocos2d.
I followed this: http://bitbattalion.com/2011/09/uikit-uiscrollview-and-cocos2d/
Then, I completed it with this: Animation in OpenGL ES view freezes when UIScrollView is dragged on iPhone
It seems to work fine on the simulator but gets weird on the iPod: it is very jerky and does not keep scrolling when you flick it. This behavior goes away after you flick it around a while and sometimes it starts up fine.
I am using iOS 5.1 and cocos2d 2.x.
Any ideas?
Upvotes: 1
Views: 572
Reputation: 64477
Try setting the animation interval to half of your current frame rate while displaying the scroll view:
CCDirector* director = [CCDirector sharedDirector];
director.animationInterval = director.animationInterval * 2.0f;
Then later when you are no longer displaying the scroll view, reset it back to the original interval.
I also found that in my case the second link (OpenGL freezes) didn't work. I had to actually use GCD and a semaphore to in cocos2d's main rendering method to allow Cocoa enough time to animate and render its own stuff.
Upvotes: 3