Skip to content

Commit

Permalink
Fix bugs and Update demo app
Browse files Browse the repository at this point in the history
  • Loading branch information
lkzhao committed Jan 7, 2016
1 parent 3727df0 commit 644c16f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
20 changes: 16 additions & 4 deletions ElasticTransition/ElasticTransition.swift
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,16 @@ public class ElasticTransition: EdgePanTransition, UIGestureRecognizerDelegate{
```
*/
public var shadowColor:UIColor = UIColor(red: 100/255, green: 122/255, blue: 144/255, alpha: 1.0)

/**
The shadow color of the container when doing the transition
default:
```
UIColor(red: 100/255, green: 122/255, blue: 144/255, alpha: 1.0)
```
*/
public var frontViewBackgroundColor:UIColor?
/**
The shadow radius of the container when doing the transition
Expand Down Expand Up @@ -366,9 +376,11 @@ public class ElasticTransition: EdgePanTransition, UIGestureRecognizerDelegate{

// 2. setup shadow and background view
shadowView.frame = container.bounds
if let vc = frontViewController as? UINavigationController,
let rootVC = vc.childViewControllers.first{
shadowMaskLayer.fillColor = rootVC.view.backgroundColor?.CGColor
if let frontViewBackgroundColor = frontViewBackgroundColor{
shadowMaskLayer.fillColor = frontViewBackgroundColor.CGColor
}else if let vc = frontViewController as? UINavigationController,
let rootVC = vc.childViewControllers.last{
shadowMaskLayer.fillColor = rootVC.view.backgroundColor?.CGColor
}else{
shadowMaskLayer.fillColor = frontView.backgroundColor?.CGColor
}
Expand All @@ -393,7 +405,7 @@ public class ElasticTransition: EdgePanTransition, UIGestureRecognizerDelegate{
}
frontView.frame = rect
if navigation{
frontViewController.navigationController!.view.addGestureRecognizer(navigationExitPanGestureRecognizer)
frontViewController.navigationController?.view.addGestureRecognizer(navigationExitPanGestureRecognizer)
}else{
frontView.addGestureRecognizer(foregroundExitPanGestureRecognizer)
}
Expand Down
4 changes: 2 additions & 2 deletions ElasticTransitionExample/InitialViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ class InitialViewController: UIViewController {

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
let vc = segue.destinationViewController
vc.transitioningDelegate = transition
vc.modalPresentationStyle = .Custom
if segue.identifier == "navigation"{
if let vc = vc as? UINavigationController{
vc.delegate = transition
}
}else{
vc.transitioningDelegate = transition
vc.modalPresentationStyle = .Custom
if let vc = vc as? AboutViewController{
vc.transition = transition
}
Expand Down

0 comments on commit 644c16f

Please sign in to comment.