No Description

FFTransitioning.swift 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. //
  2. // FFTransitioning.swift
  3. // FFAlert
  4. //
  5. // Created by FFIB on 2017/11/13.
  6. // Copyright © 2017年 FFIB. All rights reserved.
  7. //
  8. import UIKit
  9. class FFTransitioning: NSObject, UIViewControllerTransitioningDelegate {
  10. private let alertStyle: FFAlertStyle
  11. init(alertStyle: FFAlertStyle) {
  12. self.alertStyle = alertStyle
  13. }
  14. func presentationController(forPresented presented: UIViewController,
  15. presenting: UIViewController?, source: UIViewController)
  16. -> UIPresentationController? {
  17. return FFPresentationController(presentedViewController: presented, presenting: presenting)
  18. }
  19. func animationController(forPresented presented: UIViewController,
  20. presenting: UIViewController, source: UIViewController)
  21. -> UIViewControllerAnimatedTransitioning? {
  22. if self.alertStyle == .actionSheet {
  23. return nil
  24. }
  25. return FFAnimationTransitioning(presentation: true)
  26. }
  27. func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
  28. return self.alertStyle == .alert ? FFAnimationTransitioning(presentation: false) : nil
  29. }
  30. }