Closed sgtsquiggs closed 7 years ago
This sounds more like a broken outlet connection
. You're using NibDesignableCollectionViewCell
right?
My xib has a UICollectionViewCell
inside. File owner is set to my custom ArtworkCollectionViewCell
, which is a subclass of NibDesignableCollectionViewCell
.
I am not getting the original error anymore, but also I am not able to properly calculate the size of the cell (for use in a waterfall layout). Sizing always returns 0,0 with cell.contentView.systemLayoutSizeFittingSize(UILayoutFittingCompressedSize)
I noticed you end up with a UICollectionViewCell within a UICollectionViewCell, would this be causing the issue?
You "can" use UIView in the nib file (and i suggest you to), because it's gonna be added to contentView
of UICollectionViewCell
anyway, If you use UICollectionViewCell
in nib file, there's just gonna be more subviews (and cause performance issues). But it has nothing to do with the error you've mentioned earlier. Did you check all your outlet connections
? and one more thing, your app crashes with this error? or you're just seeing this error in console?
If it's printed in console, You've probably set some attributes as @IBInspectable
and removed it later... they're still there in User Defined Runtime Attributes
I guess so, I remember having this problem but I'm not sure using UIView
in nib file fixed it, or something else.
That somewhat fixed it. I've got some other bugs but using a simple UIView instead of a cell fixed sizing. This could be made clearer with a proper demo :)
I'm glad your problems solved :)
This bugged me for a while too (I even experienced recursive crash on IB 😃) but it's written in ReadMe file:
Create a nib, place a UIView and change the File's Owner to CustomView
I think it should indicate more boldly that you should use UIView for all NibDesignables
Yeah. In the past with other nib designables I used the cell class directly with no file owner. Funky but it worked, which is how I was mixed up here.
I am implementing UICollectionViewCell the same way I would a regular UIView with NibDesignable but I can't get it to work. Always getting errors similar to
this class is not key value coding-compliant for the key randomLabel
.