Animation of CGAffineTransform in iOS8 looks different than in iOS7

前端 未结 6 1895
南方客
南方客 2021-02-02 11:59

I\'m trying to find a reason why animation of UIView transform property looks different in iOS 8 than iOS 6/7.

For a simple example, prior to iOS 8:

6条回答
  •  耶瑟儿~
    2021-02-02 12:49

    CGAffineTransformIdentity behaves differently on ios7 and ios8. This has to do with auto-layout and size classes. The solution is to remove constraints that conflict with the animation on ios7.

    // solve the constraint-animation problem
    if(NSFoundationVersionNumber <= NSFoundationVersionNumber_iOS_7_1) {
        // iOS7 remove constraints that conflict with animation
        if (self.centerYAlignment != nil) {
            self.view.removeConstraint(self.centerYAlignment) //is an IBOutlet 
        }
    } else {
        // iOS8 constraint animations are fine
    }
    

提交回复
热议问题