I'm using Spritebuilder to make my game, and CCScrollView usually saves me quite a bit of time. I'm trying to implement the scroll view much in the same way as the home screen on an iphone uses the UIScrollView. I want the page indicators to be visible and change as you scroll through the pages (the little white dots for iOS 7).

In Spritebuilder I set up the CCScrollView as a child of a CCNode. Then I set the content node to another one of my ccbi files, EasyPackpage1. When I run my project, everything works pretty well. I currently have a content node that is large enough so that it has three different pages, so if I scroll to the right it locks onto the next page, scroll to the right again, it locks onto the next page. The only problem is that the page indicators are non-existent. How can I get these page indicators?

If someone knows the solution for doing this using purely code, that would also be greatly appreciated. Cocos2d v3 still has very little documentation and I haven't been able to find much on how to use CCScrollView, since it looks like CCScrollLayer is deprecated in v3.

enter image description here

Thanks for the help!

  • \$\begingroup\$ Have you been able to implement the page indicators? \$\endgroup\$
    – Justin D.
    Commented May 2, 2014 at 19:05
  • \$\begingroup\$ IT turns out that CCScrollView doesn't support page indicators, therefore there is no way that Spritebuilder could support them. If you want page indicators in your game, you're either going to have to create a UIViewController from scratch and transition to it using code, or you could take a more simple solution like I did. I simply added in the page indicator sprites to the bottom of the page to a static view, then added the CCScrollView to the static view. You can track which page of the scroll you are on using CCScrollView, so you can highlight your added sprites accordingly. \$\endgroup\$ Commented May 2, 2014 at 19:37
  • \$\begingroup\$ That's indeed a simple solution and it's what I ended up doing. I will answer your question so that future programmers can find a solution easily. \$\endgroup\$
    – Justin D.
    Commented May 2, 2014 at 23:41

1 Answer 1


The trick is to use the CCScrollViewDelegate methods to detect scroll events.

Add a CCLabelTTF and call it _pageLabel.

In Xcode, make the scene containing your scroll view adhere to the CCScrollViewDelegate :

@interface myScene : CCNode <CCScrollViewDelegate>

Then, in didLoadFromCCB, set the scroll view delegate to self :

_scrollView.delegate = self;

and finally,

- (void)scrollViewDidScroll:(CCScrollView *)scrollView
    // change your page indicator label or sprite to show new page
        // use _scrollView.horizontalPage to get the page

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .