Set the amount of Paging Enabled ScrollView scrolling

Asked 2 years ago, Updated 2 years ago, 75 views

I checked Paging Enabled in ScrollView on Storyboard to scroll through the images one page at a time, but I would like to scroll through the images one page at a time, not one page at a time.In other words, I would like to page several times within one page.What should I do in this case?

objective-c uiscrollview

2022-09-30 19:10

1 Answers

I have found the best answer for my home, so I will write it down.

CGRect frame = scrollView.frame;
frame.origin.x = frame.size.width * pageNumberYouWantToGo; // Number of pages
frame.origin.y = 0;
scrollView scrollRectToVisible:frame animated:YES;

Reference Change page on UIScrollView


2022-09-30 19:10

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.