JLCustomerAlertController.m 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. //
  2. // JLAlertController.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 "JLCustomerAlertController.h"
  9. #import "JLPresentationController.h"
  10. @interface JLCustomerAlertController () <UIViewControllerTransitioningDelegate>
  11. @end
  12. @implementation JLCustomerAlertController
  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. - (void)viewDidLoad {
  43. [super viewDidLoad];
  44. // Do any additional setup after loading the view.
  45. self.view.backgroundColor = [UIColor whiteColor];
  46. }
  47. - (void)didReceiveMemoryWarning {
  48. [super didReceiveMemoryWarning];
  49. // Dispose of any resources that can be recreated.
  50. }
  51. #pragma mark - UIViewControllerTransitioningDelegate
  52. // ios 8
  53. - (UIPresentationController *)presentationControllerForPresentedViewController:(UIViewController *)presented presentingViewController:(UIViewController *)presenting sourceViewController:(UIViewController *)source {
  54. return [[JLPresentationController alloc] initWithPresentedViewController:presented presentingViewController:presenting];
  55. }
  56. #pragma mark - Animator
  57. // present
  58. - (id<UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source {
  59. return nil;
  60. }
  61. // dismiss
  62. - (id<UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed {
  63. return nil;
  64. }
  65. @end