animate rotation UIImageView in swift

后端 未结 10 2293
抹茶落季
抹茶落季 2021-02-06 23:11

I\'m trying to animate a rotation of 180 degrees of a UIImageView in Swift

    UIView.animateWithDuration(1.0, animations: { () -> Void in
              


        
10条回答
  •  梦如初夏
    2021-02-06 23:27

    You left out the / 180 on CGFloat(180 * M_PI). Try:

    UIView.animate(withDuration: 1.0) {[weak self] in
        self?.arrowImageView.transform = CGAffineTransform(rotationAngle: CGFloat(Double.pi))
    }
    

提交回复
热议问题