为什么我的collectionview内容在我的containerView下面

问题描述 投票:0回答:2

我有一个collectionviewController和一个containerView,其中包含text fieldbutton,点击发送消息。 containerView固定在我的view底部,高度固定。 collectionViewCell正在containerView下。 喜欢这个My simulator screen how my view is right now

我想要的观点是collectionView的底部始终位于containerview的顶部。喜欢这个My simulator screen how my view needs to be

我也尝试将collectionView的底部约束设置为containerView的顶部约束。

提前致谢。

ios uicollectionview
2个回答
0
投票

您应该尝试从界面构建器添加视图添加前导,尾随,底部约束和固定高度约束。之后,在collectionview及其superview之间添加前导,尾随,顶部约束。最后添加collectview的底部= containerView约束的顶部。

如果无法从故事板添加视图,只需在storyboard中创建一个空占位符UIView,其具有与上述相同的约束,然后将容器视图添加到占位符。


0
投票

在collectionView之后添加您的containerView,它将覆盖。

如果这不起作用,请使用view.bringSubviewToFront(containerView),containerView应显示在顶部

© www.soinside.com 2019 - 2024. All rights reserved.