简体   繁体   English

UI集合视图单元格和自动布局

[英]UI Collection View Cells and Auto Layout

I have a screen in interface builder that consists of a UI Collection View containing reusable cells. 我在界面构建器中有一个屏幕,其中包含一个包含可重用单元格的UI集合视图。 I've used Interface builder to add Auto Layout constraints to the UI Collection view and its scaling and moving about on each device like it should. 我已经使用“界面”构建器将“自动布局”约束添加到“ UI集合”视图中,并对其缩放和在每个设备上的移动进行了调整。 How can I use the same method (control dragging) to auto layout the cells width and height? 如何使用相同的方法(控制拖动)自动布置单元格的宽度和高度? I can get constraint options via control dragging for the child objects in the cell to the cell but not from the cell to say the UI Collection View. 我可以通过将单元中的子对象拖到单元中而不是从单元中拖出UI集合视图的控件来获得约束选项。

Any help greatly appreciated! 任何帮助,不胜感激!

Thanks. 谢谢。

You don't. 你不知道 Collection views manage the placement of the cells within the view themselves, using their own rules. 集合视图使用它们自己的规则来管理单元在视图自身中的放置。 You can certainly use AutoLayout to determine the size and placement of the entire collection view, and you can use it for the internal layout of individual cells, but you can't use AutoLayout to size or position the cells within the collection view. 您当然可以使用AutoLayout来确定整个集合视图的大小和位置,并且可以将其用于单个单元格的内部布局,但是您不能使用AutoLayout在集合视图中调整单元格的大小或位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM