iOS Bug: Occluded UIView with CABasicAnimation not redrawn

iOS Bug: Occluded UIView with CABasicAnimation not redrawn

I have a UIImageView that holds album artwork in a project. When I get a new now playing notification, instead of simply setting the image to the image view, I perform a crossfade. It’s a lot prettier that way. No problems so far.

Here is a snippet of the crossfading code.

Nothing remarkable there. Now… if I add a sliding panel above the UIImageView, and it expands over the image view, and a crossfade is initiated, when the panel slides away later, the image won’t have updated with the new one. It shows the old artwork associated with the previous song. A stale image state. I thought I was going mad for a bit.

I had a suspicion that the image view needed to be visible to perform the redraw update, so I added a small delay to crossfade after the panel responded to my close event. Enough for a tiny sliver of the image view to be visible in the UI before the crossfade was called. It worked.

My final solution: set the panel on top to an alpha value of 0.99 instead of 1.0 – you can’t visually tell that the panel is a tiny bit transparent. This works – I removed the delay thing because that was even more hackish in my opinion.

I have filed this iOS UIKit bug with Apple. My device is running 10.1 and not 10.1.1 – because I didn’t want to potentially change the core OS before my application delivery (just in case it caused a bug or two someplace).

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.