启用分页的UICollectionView [英] UICollectionView with Paging Enable

查看:84
本文介绍了启用分页的UICollectionView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须创建类似于Appstore iOS应用程序的Grid视图.我想通过UICollectionView分页来做到这一点.我还实现了代码,但无法像这样滚动.

I have to create Grid view like Appstore iOS app. I want to do this with UICollectionView paging. I have also implemented the code but not able to scroll like that.

我想做的是在中心和左右两侧(左和右)有一个图像,它应该显示上一张和下一张图像的一部分.我已将UICollectionView的Frame设置为320 * 320.像元大小为290 * 320.(像元最小间距为10) 1

What I want to do is there will one image in Center and at both sides(left and right), it should show some portion of previous and next image. I have set Frame for UICollectionView is 320*320. cell size is 290*320.(cell min spacing is 10)1

下面是两个描述我的要求的链接.预先感谢.

Below are two links which depicts my requirement. Thanks in advance.

(这就是我想要的) 2

推荐答案

您是否尝试过将UICollectionViewFlowLayout的滚动方向设置为水平?

Have you tried setting the scroll direction of your UICollectionViewFlowLayout to horizontal?

[yourFlowLayout setScrollDirection:UICollectionViewScrollDirectionHorizontal];

您将需要在集合视图上启用分页,如下所示:

You'll need to enable paging on your collection view like so:

[yourCollectionView setPagingEnabled:YES];

这篇关于启用分页的UICollectionView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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