objective c - UIScrollView custum paging distance -


A UIScrolView (includes full width of the screen) wants a UIImage (the width of the image is> 320px) and want a paging effect

.

All tutorials / examples I have found in how to do this with many UI images or UIUUs, but I have only 1 UIImage in the UIScrollView. My purpose is to create a 'tape measure' like effect and should scrollviewview 'page' on each marker of the tape?

Cheers

About the cleaner solution than doing the math on the fly Can not think. If the desired page length "slide" is UIImage 100px so that it remains relative to the original page. So something like this:

  cgflot pageview = 100; Int numpages = ceilf (myImageView.bounds.size.width / pageWidth); ScrollView.contentSize = CGSizeMake (numpages * scrollView.bounds.size.width, scrollView.bounds.size.height);  

Then scroll to the class> layout subviews method:

  - (zero) layout view view {int numpages = ceilf (myImageView). Bounds .ize.width / pageWidth); CGRature visible bounds = [self limit]; Start CGFloat = visible bounds. Orgin.x; CGFloat offset = start / pageWidth; MyImageView.frame = CGRectMake (offset, myImageView.frame.origin.y, myImageView.frame.size.width, myImageView.frame.size.height); }  

I have not tested it at all, but hopefully it will take you to a working track. Whenever you scroll, what should be , the image is running, it seems that each "page" only transfers the 100px image.


Comments