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.