启用分页的UICollectionView

编程入门 行业动态 更新时间:2024-10-27 22:29:20
本文介绍了启用分页的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

本文发布于:2023-11-26 03:41:16,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1632492.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:分页   UICollectionView

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!