I'm developing iMessage Extension app. My problem is that the collection view is visible behind navigation bar(I think navbar is automatically produced by iMessage Extension) in expand mode. We can see collectionview (with transparency) behind navbar. Is there anybody who has experience in this area? Looking for any help.
Asked
Active
Viewed 499 times
1
-
have you set constraint perfectly? – seggy Oct 22 '16 at 11:22
-
Yeah, of course, top:0, left:0, right:0, bottom: 0 – Ioan Moldovan Oct 22 '16 at 11:23
-
try to set navigation nav bar translucent = NO – Wos Oct 22 '16 at 11:24
-
Let me know it's working or not – Wos Oct 22 '16 at 11:25
-
Try navigationController?.navigationBar.isTranslucent = false this will fix your problem – Joe Oct 22 '16 at 11:36
-
@Joe I tried it for long time ago, It doesn't work for iMessage extension. – Ioan Moldovan Oct 22 '16 at 11:51
-
Is ur collectionView programmically created? – Joe Oct 22 '16 at 11:53
-
@Joe no, in storboard, and all constraints are set properly. – Ioan Moldovan Oct 22 '16 at 11:54
-
Then it's easy fix. Can you post your viewDidLoad... – Joe Oct 22 '16 at 11:56
-
I have nothing in viewDidLoad, – Ioan Moldovan Oct 22 '16 at 11:57
-
Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/126395/discussion-between-david-jonker-and-joe). – Ioan Moldovan Oct 22 '16 at 11:58
2 Answers
0
Referring to @seggy question comment:
have you set constraint perfectly?
You answered:
Yeah, of course, 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).
Also, you might need to change the bottom constraint's constant value.
Hope this helped.

Ahmad F
- 30,560
- 17
- 97
- 143
0
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:
CollectionView.Top = Top Layout Guide.Bottom is set to 0.
In 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

Pragnesh Vitthani
- 2,532
- 20
- 28