iPhone UIScrollview 页面
我有一个水平滚动视图:
[journal setPagingEnabled:YES];
我一直在使用自定义方法在触摸按钮时向右滚动
[journal setContentOffset:CGPointMake(320,0) animated:YES];
是否存在用于处理页面的现有方法以及如何找到它?
谢谢, 路
I have a horizontal scrollview with :
[journal setPagingEnabled:YES];
I've been using a custom method to scroll to the right on the touch of a button
[journal setContentOffset:CGPointMake(320,0) animated:YES];
Is there an already existing method for working with pages and how do I find it?
Thanks,
Rd
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您正在寻找类似
[myScrollViewscrollToPage:3]
的内容,那么不,没有内置方法。如果您确实想要明确的东西,那么自己推出也很容易。假设一个水平分页的 UIScrollView:好吧,方法名称很糟糕,但这就是基本思想。我可能更适合 UIScrollView 上的类别。
If you're looking for something like
[myScrollView scrollToPage:3]
, then no, there is no built in method. It's also pretty easy to roll your own if you really want something explicit. Assuming a horizontally paged UIScrollView:Okay, the method name is terrible, but that's the basic idea. I may be nicer in a Category on UIScrollView.
这是 Matt Gallagher 关于分页 UIScrollView 的精彩博客文章 。我在我的一个项目中使用了它,需要一些调整,但除此之外按预期工作。
Here's a brilliant blog post on paged UIScrollView by Matt Gallagher. I used it in a project of mine, required some tweaking but otherwise was working as expected.
UIPageControl
< /a> 的工作方式与 iPhone 的 SpringBoard(主屏幕)功能类似。The
UIPageControl
works similar to the way that the iPhone's SpringBoard (home screen) functions.