JLCustomerNavigationAlertController.m 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. //
  2. // JLCustomerNavigationAlertController.m
  3. // Apex Mobile
  4. //
  5. // Created by Jack on 2018/1/31.
  6. // Copyright © 2018年 United Software Applications, Inc. All rights reserved.
  7. //
  8. #import "JLCustomerNavigationAlertController.h"
  9. #import "JLPresentationController.h"
  10. @interface JLCustomerNavigationAlertController () <UIViewControllerTransitioningDelegate>
  11. @end
  12. @implementation JLCustomerNavigationAlertController
  13. - (void)comonInit {
  14. // present
  15. self.transitioningDelegate = self;
  16. /**
  17. * 非Customer时,
  18. * Present会将FromVC.view从Window移除
  19. * Dismiss动画结束后VC.view自动添加到Window
  20. */
  21. self.modalPresentationStyle = UIModalPresentationCustom;
  22. }
  23. - (instancetype)initWithCoder:(NSCoder *)coder {
  24. self = [super initWithCoder:coder];
  25. if (self) {
  26. [self comonInit];
  27. }
  28. return self;
  29. }
  30. - (instancetype)init {
  31. if (self = [super init]) {
  32. [self comonInit];
  33. }
  34. return self;
  35. }
  36. - (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
  37. if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
  38. [self comonInit];
  39. }
  40. return self;
  41. }
  42. - (instancetype)initWithRootViewController:(UIViewController *)rootViewController {
  43. if (self = [super initWithRootViewController:rootViewController]) {
  44. [self comonInit];
  45. }
  46. return self;
  47. }
  48. - (void)viewDidLoad {
  49. [super viewDidLoad];
  50. // Do any additional setup after loading the view.
  51. }
  52. - (void)didReceiveMemoryWarning {
  53. [super didReceiveMemoryWarning];
  54. // Dispose of any resources that can be recreated.
  55. }
  56. #pragma mark - UIViewControllerTransitioningDelegate
  57. // ios 8
  58. - (UIPresentationController *)presentationControllerForPresentedViewController:(UIViewController *)presented presentingViewController:(UIViewController *)presenting sourceViewController:(UIViewController *)source {
  59. return [[JLPresentationController alloc] initWithPresentedViewController:presented presentingViewController:presenting];
  60. }
  61. #pragma mark - Animator
  62. // present
  63. - (id<UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source {
  64. return nil;
  65. }
  66. // dismiss
  67. - (id<UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed {
  68. return nil;
  69. }
  70. @end