0

I was trying to add LOTAnimationView to my collection view cell, but nothing appears on the screen when I run the program.Here is the link to lottie. And Here is the code:

class Cell: UICollectionViewCell{

var animationView: LOTAnimationView!

override func awakeFromNib() {
    super .awakeFromNib()
    animationView = LOTAnimationView(name: "Animation")
    self.contentView.addSubview(animationView!)

}
Habib Alejalil
  • 435
  • 1
  • 4
  • 17
E.Ergit
  • 111
  • 1
  • 8

2 Answers2

0

1- is you JSON animation has been added to your target? 2- verify that your animation file is Animation.json

thierryb
  • 3,660
  • 4
  • 42
  • 58
  • 1
    yea, its a JSON file and it's been added to the target. I can add the animation to a normal view just fine, but when I try to place it in UICollectionViewCell nothing happens – E.Ergit Oct 13 '17 at 20:10
0

You just created an instance and added it to the subview which is cool..
Where are you calling the 'Play()' command, is it from the datasource/delegate class?
Try calling the 'Play()' command in the custom cell itself i.e. in awakeFromNib() method. It should work.

Naveen
  • 494
  • 1
  • 4
  • 18