相关疑难解决方法(0)

How to center align the cells of a UICollectionView?

I am currently using UICollectionView for the user interface grid, and it works fine. However, I'd like to be enable horizontal scrolling. The grid supports 8 items per page and when the total number of items are, say 4, this is how the items should be arranged with horizontal scroll direction enabled:

0 0 x x
0 0 x x
Run Code Online (Sandbox Code Playgroud)

Here 0 -> Collection Item and x -> Empty Cells

有没有办法使它们居中对齐,如:

x 0 0 x
x 0 0 x
Run Code Online (Sandbox Code Playgroud)

这样内容看起来更干净? …

ios uicollectionview

96
推荐指数
11
解决办法
9万
查看次数

33
推荐指数
4
解决办法
3万
查看次数