I have a CCScene. In its right side I need to have a UIScrollView with some menu elements. I did it this way as I have explained in this previous question Cocos2d and UIScrollView
here is the method creating my scene
+(id) scene: (int) wld{
CCScene *scene = [CCScene node];
LevelsMenu *layer = [LevelsMenu node];
layer = [layer init:wld];
[scene addChild: layer];
[layer setScrollView:[LevelMenuControlView alloc]];
[[[CCDirector sharedDirector] openGLView] addSubview:layer.scrollView.view];
return scene;
}
notice that LevelMenuControlView is just an UIViewController implemented this way:
- (void)loadView{
LevelMenuView *scrollView = [[LevelMenuView alloc] initWithFrame:[UIScreen
mainScreen].applicationFrame];
scrollView.contentSize = CGSizeMake(862, 480);
scrollView.delegate = scrollView;
[scrollView setUserInteractionEnabled:TRUE];
[scrollView setScrollEnabled:TRUE];
[scrollView setShowsVerticalScrollIndicator:FALSE];
[scrollView setShowsHorizontalScrollIndicator:FALSE];
self.view = scrollView;
[scrollView release];
}
While LevelMenuView is the UIScrollView containing the menu elements
It works quite fine. Now the problem is that in the left side of the scene I have a sprite animation that, If I do not touch the screen fine but as soon as I drag the scroll view up or down stops or goes at the same speed of my scrolling finger!!!
Any idea?
I have found this link where someone already experienced the same problem and posted a solution which actually works
http://www.cocos2d-iphone.org/forum/topic/11645
It basically consists in adding this code to the scroll view:
Thanks a lot to these guys