ios - iphone x 中的 UICollection header 已满

标签 ios swift uicollectionview

我在 UICollectionView 中工作,我正在使用“Setion Header”选项,一切正常,除了在横向模式下 iPhone X 没有完全填满。

例如,我试图找到一个解决方案,但它对我不起作用:

    if #available(iOS 11.0, *) {
        myCollection?.contentInsetAdjustmentBehavior = .always
    }

对此有什么建议吗?

在肖像中它看起来不错:

my collection app

PORTRAID

我的观点顺序:

views

最佳答案

您可以为它使用尺寸等级。

在 Storyboard 中点击底部的 view as :

enter image description here

并将方向更改为横向。

选择 collectionView 的尾部约束:

enter image description here enter image description here

compact-compact 的约束变体引入为 -44。

enter image description here

最终的用户界面将是:

enter image description here

对前导约束重复相同的过程。 希望它能帮助你在这里实现目标。快乐编码

编辑

用 Google 搜索并在 SO 中得到了同样的问题:

这可能有助于您实现目标。

关于ios - iphone x 中的 UICollection header 已满,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51738197/

相关文章:

ios - 推送通知到达时应用程序角标(Badge)图标未更新

ios - 如何停止 MPMoviePlayerViewController 在 moviePlaybackDidFinish 上的自动关闭?

ios - 删除 uicollectionview 顶部的额外空间

ios - 选择“图像”或“拍照”并转到新的 ViewController

iphone - 大型 UICollectionViewCell 随自定义布局消失

ios - 段错误 11 与 Obj-C-bridge.h 有关吗?

ios - iPad 上的核心数据获取速度非常慢

ios - 自定义类中未调用委托(delegate)方法

ios - UIAlertViewcontroller 在转到 viewcontroller 之前没有被弹出

ios - 在自定义 UIPrintPageRenderer 中使用 UIFont 绘制字符串对象