I've been developing an app in XCode 7 and all was well. I thought "hey, let's update to iOS 10" so opened up the project in XCode 8 and started fixing warnings and looking for issues.
Now it seems that UIView
s load up with blank backgrounds, either from storyboard or created in code. In storyboard I have a UIView
with a redColor
background but the first time it's displayed (in a UICollectionViewCell
) it appears with a clearColor
background, or so it would appear, debugging it everything looks fine under the hood. When I swipe away from the cell and come back to that same cell (either by swiping back or the cell being recycled) it gets its correct colour... I've tried [cell setNeedsDisplay]
and [cell setNeedsLayout]
to no avail...
Even if I try and set the backgroundColor
in my code it doesn't help how it looks when initially displayed.
Nothing unexpected is setting the background colour (checked by making a custom class that overrides the function) and the view isn't hidden, nor has 0 alpha (subviews show fine).
I should point that is seems to be clearColor
because some subview UILabel
s I've got are still showing up ok.
I don't think there's any more information I can provide but feel free to ask!
EDIT: Turns out the backgroundColor
is probably being honoured fine but something odd is going on with the layout of the view. The frame seems fine but if I use clipsToBounds
then my subview labels disappear so the views frame must be off-screen somewhere or zero-sized...