2

I have implemented an UIScrollView.It contains small images of 60 width size. The scroll movement always steps 3 pictures forward or back, not one by one as I need. Please see the attached pictures that explain this point.

enter image description here

ScrollView has paging enabled. Here is the code:

for (int i = 0; i < numberOfViews; i++) {

        UIImage *myImage = [UIImage imageNamed:[fotosJugadores objectAtIndex:i]];
        CGFloat yOrigin = i * myImage.size.width + 120;
        UIImageView *awesomeView = [[UIImageView alloc] initWithFrame:CGRectMake(yOrigin, 0, myImage.size.width, myImage.size.height)];
        awesomeView.image = myImage;
        awesomeView.tag = i;
        [self.jugadorSlide addSubview:awesomeView];
        awesomeView=nil;
    }

    [jugadorSlide setBackgroundColor:[UIColor blackColor]];
    jugadorSlide.contentSize = CGSizeMake(65 * numberOfViews+240,78);
    jugadorSlide.layer.cornerRadius = 11;
    jugadorSlide.layer.masksToBounds = YES;
    [jugadorSlide setContentOffset:CGPointMake(((65 * numberOfViews)/2), 0)];
    [self scrollViewDidEndDecelerating:jugadorSlide];

Many thanks

theomen
  • 913
  • 3
  • 20
  • 39
  • I don't really understand "steps 3 pictures forward or back" could you add some screenshots ? Also, I don't see the paging enabled in your code. – Titouan de Bailleul May 14 '12 at 19:28

1 Answers1

2

Ok, I think I know what you mean. Would these links help you

UIScrollView - with paging enabled, can I "change" the page width?

Paging UIScrollView with different page widths

UIScrollView + pagingEnabled, scroll half a page?

Hope this helps

Community
  • 1
  • 1
Titouan de Bailleul
  • 12,920
  • 11
  • 66
  • 121