Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I fix the "misplaced views" warning of collection view elements in Xcode 9?

Tags:

ios

xcode9

So I use Xcode 9.2, for a month I didn't have this problem working on the project. Today, I remember I changed the navigation bar to be "NOT" translucent in the storyboard. After I unchecked it, these two warnings appeared.

I have read and done many solutions suggested in here and other websites, but it's still there. I haven't found the solution for issues happening on Xcode 9 though. The fixes Xcode give (I tried to update constraints and reset to suggested constraints) do nothing if the "fix misplacement" is clicked.

section header and cell of collection view - misplaced views warning

I have set the heights through the storyboard.
I have set the heights through the code as well but still no luck. And there is no problem at all on the app after running it.

I wonder if this a bug, which I read happening in Xcode 8 and earlier, or there is just a simple fix in Xcode 9 which I don't know.
I haven't found anyone having this problem in Xcode 9, so I give a shot to ask. Any help is really appreciated.

Thank you in advance!

like image 613
Swift Mage Avatar asked Dec 10 '17 21:12

Swift Mage


1 Answers

I was getting a continuous "misplaced views" warning on my Collection View Cell.

It said "Expected: width = 0, height = 0"

I got the warning to go away by dragging the corners of it to be size 0,0 on the storyboard. I can't see the cell now, but I don't have a bothersome warning either.

like image 181
Justin Lewis Avatar answered Oct 10 '22 04:10

Justin Lewis