I'm using the Lottie API to have a custom Animation View in one of my static table view cells using the below code. However, the view is not appearing.
I have tested other Lottie files, therefore it is not the file. And I have also tested the cell by changing its backgroundColor
, which worked, so I am calling the right cell.
let index = IndexPath(row: 9, section: 0)
let cellWidth = self.tableView.cellForRow(at: index)?.frame.size.width
let cellHeight = self.tableView.cellForRow(at: index)?.frame.size.height
let animationView = LOTAnimationView(name: "loader1")
self.animationView.frame = CGRect(x: 0, y: 0, width: cellWidth! / 2, height: 50)
self.animationView.center = (self.tableView.cellForRow(at: index)?.center)!
self.animationView.contentMode = .scaleAspectFill
self.animationView.loopAnimation = true
self.tableView.cellForRow(at: index)?.addSubview(self.animationView)
self.animationView.play()