|
//
// FFTransitioning.swift
// FFAlert
//
// Created by FFIB on 2017/11/13.
// Copyright © 2017年 FFIB. All rights reserved.
//
import UIKit
class FFTransitioning: NSObject, UIViewControllerTransitioningDelegate {
private let alertStyle: FFAlertStyle
init(alertStyle: FFAlertStyle) {
self.alertStyle = alertStyle
}
func presentationController(forPresented presented: UIViewController,
presenting: UIViewController?, source: UIViewController)
-> UIPresentationController? {
return FFPresentationController(presentedViewController: presented, presenting: presenting)
}
func animationController(forPresented presented: UIViewController,
presenting: UIViewController, source: UIViewController)
-> UIViewControllerAnimatedTransitioning? {
if self.alertStyle == .actionSheet {
return nil
}
return FFAnimationTransitioning(presentation: true)
}
func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
return self.alertStyle == .alert ? FFAnimationTransitioning(presentation: false) : nil
}
}
|