views:

26

answers:

1

hi i am new to iphone.I need to create gallery, for that i am using scrollview,my code for scrollview is as fallows

UIScrollView *view = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 400, 100, 200)];     


    int row = 0;
    int column = 0;


    for(int i = 0; i < _thumbs.count; ++i) {

        UIImage *thumb = [_thumbs objectAtIndex:i];

        UIButton * button = [UIButton buttonWithType:UIButtonTypeRoundedRect];

        button.frame = CGRectMake(column*100, 350, 80,90);

        [button setImage:thumb forState:UIControlStateNormal];
        [button addTarget:self 
                   action:@selector(buttonClicked:) 
         forControlEvents:UIControlEventTouchUpInside];
        button.tag = i; 

        [view addSubview:button];

        if (column == 0) {
            column++;
        } else {
            column++;
        }

    }
    [view setContentSize:CGSizeMake(3700, (row+1) * 80 + 10)];
    self.view = view;
    [view release]; 

it works fine,but the problem is while scrolling the view entire screen will be scrolled but i need scroll only the button images i declared above,not entire view how can i done this pls help me post some code.Thank u in Advance.

A: 

view.pagingEnabled=YES;

Ashish Mathur