UIScrollView with Images

Hey, so I have 5 images that I want in a UIScrollView that the user can scroll through. But I want scrollview to stop on each image, so you will need to scroll again to see the next image.

How should I do it?

+3
source share
2 answers

you can use

myuiscrollview.pagingEnabled = YES;

for a simple method, which means that the scroll view will stop at several of its corresponding axis boundaries.

But if you want to get a little smarter, you can use the delegate method

- (void)scrollViewDidScroll:(UIScrollView *)scrollView

and use the property contentOffsetto stop at the desired point.

+3
source

pagingEnabled: UIScrollView

0

Source: https://habr.com/ru/post/1791589/