UICollectionView 布局问题 [英] UICollectionView Layout Issue

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

问题描述

我正在使用流布局使用 UICollectionView.我已经为它制作了一个自定义的 UICollectionViewCell .但是在运行项目时,控制台不断抛出这个错误 -

I am using UICollectionView using the flow layout. I have made a custom UICollectionViewCell for the same. But on running the project the console keeps on throwing this error-

The behavior of the UICollectionViewFlowLayout is not defined because:
 the item height must be less that the height of the UICollectionView minus the section insets top and bottom values.

我已经确定单元格的大小是正确的

I have made sure that the size of the cell is correct

有没有人能够解决这个问题.

Has anyone been able to resolve this issue.

推荐答案

我发现,使用storyboards,必须进入storyboard,点击整体View Controller(视图应以蓝色突出显示)并转到 Attributes Inspector(屏幕右侧的第四个选项卡)并取消选中Under Top Bars"、在底部条下"和在不透明条下".这为我解决了问题,也为我的同事解决了问题.

I found that, using storyboards, you have to go into the storyboard and click on the overall View Controller (the view should be highlighted in blue) and go to the Attributes Inspector (the fourth tab on the right side of the screen) and unchecking the "Under Top Bars", "Under Bottom Bars", and "Under Opaque Bars." This cleared up the issue for me, and it cleared it for my coworkers as well.

这篇关于UICollectionView 布局问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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