Game Development Reference
In-Depth Information
Listing 8-26 . The CCScrollViewDelegate protocol messages
// Sent repeatedly while scrolling (dragging).
- (void)scrollViewDidScroll:(CCScrollView *)scrollView;
// Sent each time the user begins touching & dragging the
scroll view.
- (void)scrollViewWillBeginDragging:(CCScrollView
*)scrollView;
// Sent each time the user lifts the finger to stop
dragging.
// decelerate parameter is YES when view will move to the
nearest page.
- (void)scrollViewDidEndDragging:(CCScrollView * )scrollView
willDecelerate:(BOOL)decelerate;
// Sent immediately after didEndDragging (only if paging is
not enabled)
- (void)scrollViewWillBeginDecelerating:(CCScrollView
*)scrollView;
// Sent when the scroll view stopped moving.
- (void)scrollViewDidEndDecelerating:(CCScrollView
*)scrollView;
You can see for yourself when each of these delegate methods run. Open
MainMenuLevelSelect.m , and add the methods in Listing 8-27 just above the @end line.
Listing 8-27 . Implementing CCScrollViewDelegate stub methods
-(void) scrollViewDidScroll:(CCScrollView *)scrollView
{
NSLog(@"%@", NSStringFromSelector(_cmd));
}
-(void) scrollViewWillBeginDragging:(CCScrollView
*)scrollView
{
NSLog(@"%@", NSStringFromSelector(_cmd));
}
-(void) scrollViewDidEndDragging:(CCScrollView * )scrollView
willDecelerate:(BOOL)decelerate
{
Search WWH ::




Custom Search