UIScrollView - 启用了分页,可以“更改”页宽? [英] UIScrollView - with paging enabled, can I "change" the page width?

查看:129
本文介绍了UIScrollView - 启用了分页,可以“更改”页宽?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个滚动视图(将pagingEnabled设置为YES)的最简单的方法是将页面宽度设置为非滚动视图的边界?



让我给一个例子。假设我有一个滚动视图有10项,每个150像素宽,我的滚动视图是300像素宽。如果我从视图1和视图2开始向右滚动,我想要下一个页面显示项目2和3.如果我再向右滚动一页,我会看到项目3和4.

有没有人这样做?

解决方案

Alexander Repty刚刚在博客中介绍了这个主题: http://blog.proculo.de/archives/180-Paging-enabled-UIScrollView -With-Previews.html 。简短的答案:这不是简单的只是改变页面的宽度,但它不是太难。


What's the simplest way to have a scroll view (with pagingEnabled set to YES) have a page width set to something other than the scroll view's bounds?

Let me give an example. Suppose I have a scroll view with 10 items, each 150 pixels wide, and my scroll view is 300 pixels wide. If I start with views 1 and 2 visible and scroll horizontally to the right, I want the next "page" to show items 2 and 3. If I scroll one more page to the right, I would see items 3 and 4.

Has anyone done this? If not, what strategy would you use?

解决方案

Alexander Repty just blogged about this very topic: http://blog.proculo.de/archives/180-Paging-enabled-UIScrollView-With-Previews.html. Short answer: it's not as simple as just changing the width of the 'page', but it's not too hard.

这篇关于UIScrollView - 启用了分页,可以“更改”页宽?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆