Skip to content

Commit

Permalink
added shadow to viewcontroller
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmetkgunay committed May 9, 2017
1 parent d9458c0 commit 74b1e88
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
6 changes: 6 additions & 0 deletions AKGPushAnimator/AKGPushAnimator/AKGPushAnimator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ public class AKGPushAnimator: NSObject, UIViewControllerAnimatedTransitioning {
let toView = toVC.view,
let fromView = fromVC.view else { return }

toView.layer.shadowOpacity = AKGPushAnimatorConstants.Common.shadowOpacity
toView.layer.shadowOffset = CGSize(width:0, height:3)
toView.layer.shadowColor = AKGPushAnimatorConstants.Common.shadowColor.cgColor
let shadowRect: CGRect = toView.bounds.insetBy(dx: 0, dy: 4); // inset top/bottom
toView.layer.shadowPath = UIBezierPath(rect: shadowRect).cgPath

if !isReverseTransition {

containerView.addSubview(fromView)
Expand Down
10 changes: 6 additions & 4 deletions AKGPushAnimator/AKGPushAnimator/AKGPushAnimatorConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,18 @@ import UIKit
struct AKGPushAnimatorConstants {

struct Common {
static let duration = 0.27;
static let dismissPosition : CGFloat = -50;
static let duration = 0.27
static let dismissPosition : CGFloat = -50
static let shadowOpacity : Float = 1
static let shadowColor : UIColor = .black
}

struct Push {
static let animateOption = UIViewAnimationOptions.curveEaseOut
static let animateOption : UIViewAnimationOptions = .curveEaseOut

}

struct Pop {
static let animateOption = UIViewAnimationOptions.curveEaseInOut
static let animateOption : UIViewAnimationOptions = .curveEaseInOut
}
}
6 changes: 6 additions & 0 deletions Source/AKGPushAnimator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ public class AKGPushAnimator: NSObject, UIViewControllerAnimatedTransitioning {
let toView = toVC.view,
let fromView = fromVC.view else { return }

toView.layer.shadowOpacity = AKGPushAnimatorConstants.Common.shadowOpacity
toView.layer.shadowOffset = CGSize(width:0, height:3)
toView.layer.shadowColor = AKGPushAnimatorConstants.Common.shadowColor.cgColor
let shadowRect: CGRect = toView.bounds.insetBy(dx: 0, dy: 4); // inset top/bottom
toView.layer.shadowPath = UIBezierPath(rect: shadowRect).cgPath

if !isReverseTransition {

containerView.addSubview(fromView)
Expand Down
10 changes: 6 additions & 4 deletions Source/AKGPushAnimatorConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,18 @@ import UIKit
struct AKGPushAnimatorConstants {

struct Common {
static let duration = 0.27;
static let dismissPosition : CGFloat = -50;
static let duration = 0.27
static let dismissPosition : CGFloat = -50
static let shadowOpacity : Float = 1
static let shadowColor : UIColor = .black
}

struct Push {
static let animateOption = UIViewAnimationOptions.curveEaseOut
static let animateOption : UIViewAnimationOptions = .curveEaseOut

}

struct Pop {
static let animateOption = UIViewAnimationOptions.curveEaseInOut
static let animateOption : UIViewAnimationOptions = .curveEaseInOut
}
}

0 comments on commit 74b1e88

Please sign in to comment.