Need some help with an advanced CALayer issue.
I have a UIView that adds a CAShapeLayer. The layer is paused (speed = 0), and it has an animation attached that I want to manually control.
Very similar to here: Tweening / Interpolating between two CGPaths / UIBeziers - Except my view is a collection view cell.
Everything works as expected, except I don't want to start from the 0 position. Each cell might start in a different position in the animation.
When the collection view asks me for my view, I'm trying to configure the layer.timeOffset to be say 0.5 rather than 0. This doesn't work, and I tried every View and Layer and delegate callbacks I could find.
The only workaround I found was in:
dequeueReusableCellWithIdentifier
instead of setting the cellView.subLayer.timeOffset = 0.5;
, I dispatch the update to later:
dispatch_after(main_queue, a bit later, ^{
cellView.subLayer.timeOffset = 0.5
});
So my question is, what is the equivalent of a viewDidLoad for Layers / Animations. When would calling timeOffset on the layer actually work?
Did anyone have this problem?