如何更改水平滚动集合视图中单元格之间的水平间距 [英] How do I change the horizontal spacing between cells in a horizontal scroll collection view

查看:24
本文介绍了如何更改水平滚动集合视图中单元格之间的水平间距的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个集合视图,它基本上是一个水平表格视图.这是一行左右滚动的单元格.有点像没有花哨动画的旋转木马.我希望能够控制细胞之间的距离.在界面构建中有一个属性可以做到这一点.它在集合视图流布局中,在检查器中(在带有小标尺的选项卡中,您通常会看到约束).它被称为 Min.Spacing 有两种变体:For CellsFor Lines.我更改了 For Cells 的值,但它不影响间距.更改参数 minimumInteritemSpacing 或使用集合视图回调都不会在每个部分的基础上指定该参数.帮助!

I have a collection view which is basically a horizontal table view. It's one line of cells that scrolls left and right. Sort of like a carousel without the fancy animation. I would like to be able to control the distance between cells. There is a property for doing that in the interface builde. It is in the collection view flow layout, in the inspector (in the tab with the little ruler where you usually see constraints). It is called Min. Spacing and has two variants: For Cells and For Lines. I changed the value of For Cells but it doesn't affect the spacing. Neither does changing the parameter minimumInteritemSpacing or using the collection view callback for specifying that parameter on a per section basis. Help!

推荐答案

答案是在水平滚动的集合视图中,单元格之间的距离,甚至是水平距离,似乎都被For Lines<控制了CollectionViewFlowLayout 的/code> 参数(在 IB 中)或 minimumLineSpacing 参数.

The answer is that in a horizontal scroll collection view, the distance between cells, even the horizontal distance, seems to be controlled by the For Lines parameter (in IB) or minimumLineSpacing parameter of the CollectionViewFlowLayout.

这个答案也隐藏在一些答案中我看到了关于集合视图中单元格间距的更普遍的问题:https://stackoverflow.com/a/48791318/826946https://stackoverflow.com/a/37420529/826946

This answer is also buried in some answers I saw more general question about cell spacing in collection views: https://stackoverflow.com/a/48791318/826946 and https://stackoverflow.com/a/37420529/826946

我决定把它分成一个单独的问题,直接解决水平滚动集合视图的问题.

I decided to separate it out into a separate question that directly addresses the issue of horitzontal scroll collection views.

这篇关于如何更改水平滚动集合视图中单元格之间的水平间距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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