UIWindow+Addtions.m 873 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. //
  2. // UIWindow+Addtions.m
  3. // HairKoK
  4. //
  5. // Created by Jason Lee on 10/18/15.
  6. //
  7. //
  8. #import "UIWindow+Addtions.h"
  9. @implementation UIWindow (Addtions)
  10. - (void)setRootViewController:(UIViewController *)rootViewController animated:(BOOL)animated {
  11. UIView *snapShotView;
  12. if (animated)
  13. {
  14. snapShotView = [self snapshotViewAfterScreenUpdates: YES];
  15. [rootViewController.view addSubview: snapShotView];
  16. }
  17. [self setRootViewController: rootViewController];
  18. if (animated)
  19. {
  20. [UIView animateWithDuration: 0.3 animations:^{
  21. snapShotView.layer.opacity = 0;
  22. snapShotView.layer.transform = CATransform3DMakeScale(1.5, 1.5, 1.5);
  23. } completion:^(BOOL finished) {
  24. [snapShotView removeFromSuperview];
  25. }];
  26. }
  27. }
  28. @end