0

I have this code that I took from here:

func changeRootViewController(viewController: UIViewController) {

    if self.window?.rootViewController == nil {
        self.window?.rootViewController = viewController
        return
    }

    let snapShot = self.window?.snapshotViewAfterScreenUpdates(true)
    viewController.view.addSubview(snapShot!)
    self.window?.rootViewController = viewController

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

        snapShot?.layer.opacity = 0.0
        snapShot?.layer.transform = CATransform3DMakeScale(1.5, 1.5, 1.5)

        }) { (value: Bool) -> Void in

        snapShot?.removeFromSuperview()
    }
}

It works fine, but it only have one problem, when the animation is finished the UIActivityIndicatorView frame is changing or there is a some kind of 'kick' to the view.

You can see it in THIS video.

Thanks in advance.

Community
  • 1
  • 1
ytpm
  • 4,962
  • 6
  • 56
  • 113
  • Did yu try the animation with completion `UIView.animateWithDuration(0.2, animations: { }, completion: { (value: Bool) in })` and put `snapShot?.removeFromSuperview()` in the competition block ? – Alaeddine Jul 12 '15 at 15:52
  • Thats not what I did here? – ytpm Jul 13 '15 at 08:23

0 Answers0