1

When animating UILabel frame size change it's working on iOS9 but not on iOS8 (on iOS8 it jump to final state instead animating). This problem disappear when using UIView or iOS9.

What can cause this problem? (You can see the project at https://github.com/IdoNave/UIlabelAnimation)

class MyView: UIView {

var progrssLabel: UILabel?

func startProgreesAnimation(from: CGFloat, duration: Double) {
    if progrssLabel == nil {
        progrssLabel = UILabel(frame: CGRect(x: 0, y: 0, width: frame.width * from, height: frame.height))
        progrssLabel?.backgroundColor = UIColor.redColor()
        self.addSubview(progrssLabel!)
    }

    UIView.animateWithDuration(duration, delay: 0, options: UIViewAnimationOptions.CurveEaseInOut, animations: {
        self.progrssLabel!.frame = self.bounds
    }) { (finish) in
        print("ProgreesAnimation ended")
    }
}

}

Ido Nave
  • 231
  • 3
  • 11

1 Answers1

0

Found the reason and solution for this issue at: https://stackoverflow.com/a/22224630/1105726 Adding the label to other view and running the animation on the view solved the problem! (more details in the link)

Community
  • 1
  • 1
Ido Nave
  • 231
  • 3
  • 11