嵌入 UITabBarController 时 UICollectionViewCells 未加载

UICollectionViewCells not loading when embedded with UITabBarController

我有两个嵌入了 UINavigationController 的 ViewController 和一个 UITabBarController。当我 运行 没有 UITabBarController 的程序时,CollectionViews 加载并正常工作。

我的问题是,当我嵌入 UITabBarController 时,ViewController 将加载,但 CollectionView 为空。

我试过将它放在 viewDidLoadviewDidAppear self.filmsCollection.reloadData() 中,但它仍然无法加载。

我已经查看了其他几个类似的问题,但解决方案均无效。我正在尝试解决当嵌入 UITabBarController 时我缺少正确加载 CollectionView 的问题。

问题出在情节提要限制上。当我添加 UITabBarController 时,它更改了约束并导致 UICollectionView 无法正确显示。

解决方案是调整约束,以便显示 UICollectionView。