xcodepaginationuiscrollviewscroll-paging

uiscrollview paging skipping pages?


hi i have a uiscrollview that i have 4 images with buttons laid out vertically in storyboard, i have paging enabled but it skips most of the images and snaps onto the last one.Is there a way to make it stop on each fullscreen image without loading a bunch of uiviews? here is the code i already have its pretty basic. .h

IBOutlet UIScrollView *scroller2;
}

@property (nonatomic, strong) IBOutlet UIScrollView *scroller2;

@end

.m 
@synthesize scroller2;
[scroller2 setContentSize:CGSizeMake(320, 3543) ];
scroller2.pagingEnabled = YES;

Solution

  • I dont have enough rep to post a comment so an answer will have to suffice.

    I was having problems replicaing your problem so I was wondering please if you could post the size of your imageViews inside the scrollView. Also are you loading the images from the web somewhere or are they just local images?

    The way paging enabled works is that it assumes that every "page" or imageview and picture in your case is right next to each other with no gaps. It calculates the pages simply by adding whatever the screen size of the device is and snapping to that next point. When you say its skipping some photos do you mean that it is snapping to halfway down a photo in some cases or just skipping right to the end?

    If you try and lay everything out right underneath each other in blocks of 480px then paging enabled should work for you.

    Hope this is of some help, let me know how you get on