以相反的顺序填充UICollectionView [英] Populating UICollectionView in reverse order

查看:106
本文介绍了以相反的顺序填充UICollectionView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想以相反的顺序填充UICollectionView,以便UICollectionView的最后一项首先填充,然后填充第二项,依此类推。实际上我正在应用动画,项目一个接一个地出现。因此,我希望最后一项显示出来。

I would like to populate UICollectionView in reverse order so that the last item of the UICollectionView fills first and then the second last and so on. Actually I'm applying animation and items are showing up one by one. Therefore, I want the last item to show up first.

推荐答案

我假设您正在使用UICollectionViewFlawLayout,这没有逻辑可以做到这一点,它只适用于TOP-LEFT BOTTOM-RIGHT订单。要做到这一点,你必须建立自己的布局,你可以创建一个从UICollectionViewLayout继承的新对象。

I'm assuming you are using UICollectionViewFlawLayout, and this doesn't have logic to do that, it only works in a TOP-LEFT BOTTOM-RIGHT order. To do that you have to build your own layout, which you can do creating a new object that inherits from UICollectionViewLayout.

看起来很多工作但不是真的那么多,你必须实现4种方法,因为你的布局只是自下而上应该很容易知道每个单元格的帧。

It seems like a lot of work but is not really that much, you have to implement 4 methods, and since your layout is just bottom-up should be easy to know the frames of each cell.

检查这里的苹果教程: https://developer.apple。 com / library / prerelease / ios / documentation / WindowsViews / Conceptual / CollectionViewPGforIOS / CreatingCustomLayouts / CreatingCustomLayouts.html

Check the apple tutorial here: https://developer.apple.com/library/prerelease/ios/documentation/WindowsViews/Conceptual/CollectionViewPGforIOS/CreatingCustomLayouts/CreatingCustomLayouts.html

这篇关于以相反的顺序填充UICollectionView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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