我有一个 10 页的 UIScrollView.我可以在它们之间轻弹.我还想要 2 个按钮(一个后退按钮和一个下一个按钮),当触摸它们时会转到上一页或下一页.我似乎无法想出办法来做到这一点.我的很多代码都来自 Apple 的页面控件示例代码.有人可以帮忙吗?
I have a UIScrollView with 10 pages. I am able to flick between them. I also want to have 2 buttons (a back button and a next button) which when touched will go to the previous or next page. I can't seem to figure out a way to do this though. A lot of my code comes from Apple's page control sample code. Can anybody help?
谢谢
你只需告诉按钮滚动到页面的位置:
You just tell the buttons to scroll to the page's location:
CGRect frame = scrollView.frame;
frame.origin.x = frame.size.width * pageNumberYouWantToGoTo;
frame.origin.y = 0;
[scrollView scrollRectToVisible:frame animated:YES];
这篇关于在 UIScrollView 上更改页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!