0

I am using a UIObject to display an animation using Lottie framework which is a submit button, and when this UIView object is tapped, the animation is played.

However the text within this animation does not appear, and the dimensions are also wrong. My UIView object has dimensions of 193*33 and the animation also does. Here is my code;

 let SubmitButton = LOTAnimationView(name: "submit_195_33")
 self.SubmitViewName.addSubview(SubmitButton)
 SubmitButton.frame = CGRect(x: 0, y: 0, width: 195, height: 33)
 SubmitButton.contentMode = .scaleAspectFill
 SubmitButton.play()

My UIView object is larger then the animation even if I use this code, and the animation is super small like this:

enter image description here

toddg
  • 2,863
  • 2
  • 18
  • 33

1 Answers1

0

Maybe you can try setting constraints to the button, for example:

submitButton.translatesAutoresizingMaskIntoConstraints = false
submitButton.widthAnchor.constraint(equalToConstant: 195).isActive = true
submitButton.heightAnchor.constraint(equalToConstant: 33).isActive = true
Alexandre Lara
  • 2,464
  • 1
  • 28
  • 35