I have a UITableView
with plenty of different custom cells 1 of those has a Lottie animation view and when I press a button or receive certain network messages the animation is supposed to jump to a specific position/progress and then animate either forward or backward.
So far, so good, all of this is working properly until I scroll down and the UITableViewCell
gets recycled which stops my animation and I lose track of the proper position/progress.
I've thought about maybe using a timer and trying to sync it with the animation progress or maybe instantiate a hidden LottieAnimationView
and syncing it with the visible one. Has anyone dealt with this problem before?
It's a fairly long, variable-length animation (usually between 20s and 30s) of a Curtain/Door that needs to be synced across multiple devices, the server sends me a message to each client whenever the curtain changes direction, the message includes the direction (open, closed or stopped) and its position as a percentage 0% to 100% (closed to open).
The animation is connected to a real device, a curtain, it is the feedback of that device, that's what the network calls are for, so it does not loop. Depending on the room the might be 2 to 4 cells with animations, each cell and animation corresponding to a different curtain, and a dozen or more cells that have 0 animations and are totally unrelated. Each cell stores a unique ID, the last motion of the curtain, the last received position for the curtain between 0% and 100% and the duration and speed of the animation.
The contents are all read from an XML file when the page is loaded. Then I'm using TCP communication to change states of switches, buttons and sliders. Like this: https://i.stack.imgur.com/sBYiX.jpg
Any suggestions?