简体   繁体   English

在iOS 10中的iMessage扩展中,导航栏后面可以看到集合视图

[英]Collection view visible behind navigation bar in iMessage Extension in iOS 10

I'm developing iMessage Extension app. 我正在开发iMessage Extension应用程序。 My problem is that the collection view is visible behind navigation bar(I think navbar is automatically produced by iMessage Extension) in expand mode. 我的问题是,在扩展模式下,导航栏后面会显示集合视图(我认为导航栏是由iMessage Extension自动生成的)。 We can see collectionview (with transparency) behind navbar. 我们可以在导航栏后面看到collectionview(透明度)。 Is there anybody who has experience in this area? 有没有人在这方面有经验? Looking for any help. 寻求任何帮助。

Referring to @seggy question comment: 参考@seggy问题评论:

have you set constraint perfectly? 你有完美的约束吗?

You answered: 你回答:

Yeah, of course, top:0, left:0, right:0, bottom: 0 是的,当然,top:0,left:0,right:0,bottom:0

The top constraint should be equals to 64 (it seems the top constraint is between the collectionView and the container view, not between the collectionView and the navigation bar). 顶部约束应该等于64(似乎顶部约束在collectionView和容器视图之间,而不是在collectionView和导航栏之间)。

Also, you might need to change the bottom constraint's constant value. 此外,您可能需要更改底部约束的常量值。

Hope this helped. 希望这有帮助。

After give Constraints(Top:0,Left:0,Right:0,Bottom:0),you should give Top Constraints of CollectionView to Top Layout Guide.Bottom ratherthan Superview.Top like this: 在给出Constraints(Top:0,Left:0,Right:0,Bottom:0)之后,你应该将CollectionView的Top Constraints赋予Top Layout Guide.Bottom ratherthan Superview.Top如下:

CollectionView.Top = Top Layout Guide.Bottom is set to 0. CollectionView.Top =顶部布局指南.Bottom设置为0。

In viewDidLoad(): 在viewDidLoad()中:

 CollectionView.frame = view.bounds
 CollectionView.translatesAutoresizingMaskIntoConstraints = false
 CollectionView.leftAnchor.constraint(equalTo: view.leftAnchor).isActive = true
 CollectionView.rightAnchor.constraint(equalTo: view.rightAnchor).isActive = true
 CollectionView.topAnchor.constraint(equalTo: view.topAnchor).isActive = true
 CollectionView.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true

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

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