Skip to content

Commit

Permalink
Merge pull request #15 from Ridwy/master
Browse files Browse the repository at this point in the history
fix bug viewWillAppear: not being called correctly
  • Loading branch information
dekatotoro committed Mar 19, 2015
2 parents dc74b38 + ac608e2 commit d0127f3
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions Source/SlideMenuController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,13 @@ class SlideMenuController: UIViewController, UIGestureRecognizerDelegate {
}

override func closeLeft() {
self.leftViewController?.beginAppearanceTransition(self.isLeftHidden(), animated: true)
self.closeLeftWithVelocity(0.0)
self.setCloseWindowLebel()
}

override func closeRight() {
self.rightViewController?.beginAppearanceTransition(self.isRightHidden(), animated: true)
self.closeRightWithVelocity(0.0)
self.setCloseWindowLebel()
}
Expand Down Expand Up @@ -315,15 +317,20 @@ class SlideMenuController: UIViewController, UIGestureRecognizerDelegate {
self.applyLeftContentViewScale()
case UIGestureRecognizerState.Ended:

self.leftViewController?.beginAppearanceTransition(!LeftPanState.wasHiddenAtStartOfPan, animated: true)
var velocity:CGPoint = panGesture.velocityInView(panGesture.view)
var panInfo: PanInfo = self.panLeftResultInfoForVelocity(velocity)

if panInfo.action == .Open {
if !LeftPanState.wasHiddenAtStartOfPan {
self.leftViewController?.beginAppearanceTransition(true, animated: true)
}
self.openLeftWithVelocity(panInfo.velocity)
self.track(.FlickOpen)

} else {
if LeftPanState.wasHiddenAtStartOfPan {
self.leftViewController?.beginAppearanceTransition(false, animated: true)
}
self.closeLeftWithVelocity(panInfo.velocity)
self.setCloseWindowLebel()

Expand Down Expand Up @@ -373,13 +380,18 @@ class SlideMenuController: UIViewController, UIGestureRecognizerDelegate {

case UIGestureRecognizerState.Ended:

self.rightViewController?.beginAppearanceTransition(!RightPanState.wasHiddenAtStartOfPan, animated: true)
var velocity: CGPoint = panGesture.velocityInView(panGesture.view)
var panInfo: PanInfo = self.panRightResultInfoForVelocity(velocity)

if panInfo.action == .Open {
if !RightPanState.wasHiddenAtStartOfPan {
self.rightViewController?.beginAppearanceTransition(true, animated: true)
}
self.openRightWithVelocity(panInfo.velocity)
} else {
if RightPanState.wasHiddenAtStartOfPan {
self.rightViewController?.beginAppearanceTransition(false, animated: true)
}
self.closeRightWithVelocity(panInfo.velocity)
self.setCloseWindowLebel()
}
Expand Down Expand Up @@ -409,6 +421,7 @@ class SlideMenuController: UIViewController, UIGestureRecognizerDelegate {
self.mainContainerView.transform = CGAffineTransformMakeScale(self.options.contentViewScale, self.options.contentViewScale)
}) { (Bool) -> Void in
self.disableContentInteraction()
self.leftViewController?.endAppearanceTransition()
}
}

Expand All @@ -435,6 +448,7 @@ class SlideMenuController: UIViewController, UIGestureRecognizerDelegate {
self.mainContainerView.transform = CGAffineTransformMakeScale(self.options.contentViewScale, self.options.contentViewScale)
}) { (Bool) -> Void in
self.disableContentInteraction()
self.rightViewController?.endAppearanceTransition()
}
}

Expand All @@ -459,6 +473,7 @@ class SlideMenuController: UIViewController, UIGestureRecognizerDelegate {
}) { (Bool) -> Void in
self.removeShadow(self.leftContainerView)
self.enableContentInteraction()
self.leftViewController?.endAppearanceTransition()
}
}

Expand All @@ -484,6 +499,7 @@ class SlideMenuController: UIViewController, UIGestureRecognizerDelegate {
}) { (Bool) -> Void in
self.removeShadow(self.rightContainerView)
self.enableContentInteraction()
self.rightViewController?.endAppearanceTransition()
}
}

Expand Down

0 comments on commit d0127f3

Please sign in to comment.