objective-ccappuccinoobjective-j

Resize content of CPScrollView


I have a CPWindow. In it, i have a CPScrollView which is set to 284px of width and 434px of height.

This code show how i fill out the CPScrollView:

for(var i = 0; i < 50; i++)
    {
        var supplie = [CPArray arrayWithArray:[[supplies objectAtIndex:0] componentsSeparatedByString:@"/"]];

        var supplieButton = [[CPButton alloc] initWithFrame:CGRectMake(0, (i * 30), 160, 25)];
        [supplieButton setTitle:[supplie objectAtIndex:0]];

        [[_scrollViewSupplies documentView] addSubview:supplieButton];

        [_listBSup addObject:supplieButton];
    }

So my problem is that for 50 buttons added, i can see only 22 of them because my CPScrollView don't resize itself..

I searched and found that the CPScrollView class need to be subclass (i'm not sure if it's the better way) but i don't know how to do this..

Please help me ! :)

Thank you for reading !

EDIT: Sorry, i said hello at the top of my post but the string "Hello !" disappears when i save the post..


Solution

  • Try [[_scrollViewSupplies documentView] setFrameSize:CGSizeMake(284, 30 * 50 + 25)].