CCScrollView - 1.6.2 - Help

I am trying to get a simple scrolling view of text and images. Instructions to be specific.

I cannot figure out how to get this implemented. I have gone in circles with this. There are no CocosSharp answers that I can find anywhere.

While I can get a CCTableView working, this is NOT what I want. The table view removes "cells" that are off the screen. Also, the implementation of this is pretty poor.

If anyone can give me pointers as to how to get started that would be helpful. Please don't comment if you have not tried this yourself.

In the code below, I am using a CCSprite as the ScrollView container. This is just for reference. I would like to just use a CCColorLayer.

In my host layer, I am calling this in my AddedToScene

var sp = new CCSprite("backgrounds/popup_bg");

   var ss = new TestSubScrollLayer(new CCSize(200f, 200f), sp);
   ss.ClippingToBounds = true;
   ss.Position = new CCPoint(500f, 1000f);


And then my TestSubScrollLayer is:

public class TestSubScrollLayer : CCScrollView, ICCScrollViewDelegate

    public TestSubScrollLayer(CCSize size, CCNode container) : base(size, container)
        base.Direction = CCScrollViewDirection.Vertical;
        base.Delegate = this;

    public void AddContent()
        float y = 50;
        for (int i=0; i < 100; i++)
            var l = new CCLabel(i.ToString() + " - row # " + i.ToString(), "fonts/MarkerFelt", 50, CCLabelFormat.SpriteFont);
            l.Position = new CCPoint(100f, y);

            y += 75f;

    public void ScrollViewDidScroll(CCScrollView view)

    public void ScrollViewDidZoom(CCScrollView view)



  • kailuenstaeden.9151kailuenstaeden.9151 DEMember
    edited February 2016

    Have a look at the attached file, I took the original source code from CCScrollView and changed some stuff, as it wasnt working at all. I use this one with sprites and it works quite like the scrollview I know from IOS. I tested it only with android for now.

    • I didnt fix the boarder stuff yet and I think just commented it out, means you can scroll endlessly in every direction.
    • deaccelaration works now as expected
    • zooming works as expected
    • its a while ago, not sure what else I changed.!m1lXTBwD!RZADUoSL9fS6Q_JtHaYK_8vtO2dANdfYZH63nrcMK5s

  • BenLevy.4265BenLevy.4265 USMember ✭✭

    @kailuenstaeden.9151 ,

    Thanks. I ended up creating my own view for what I needed. Loaded pages and animated them in/out. Actually much better for my needs. Will keep this handy if I need to implement it.

Sign In or Register to comment.