Professional Documents
Culture Documents
#import "SWRevealViewController.h"
if self.revealViewController() != nil {
menuButton.target = self.revealViewController()
menuButton.action = "revealToggle:"
self.view.addGestureRecognizer(self.revealViewController().panGestureRecognizer())
}
self.revealViewController().rearViewRevealWidth = 62
---------------------------------------------------------------------------------------------------------------------
import UIKit
func interactionControllerForPresentation(animator:
UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? {
// if our interactive flag is true, return the transition manager object
// otherwise return nil
return self.interactive ? self : nil
}
/* MenuTransitionManager */
/* MainViewController */
// now lets deal with different states that the gesture recognizer sends
switch (pan.state) {
case UIGestureRecognizerState.Began:
// set our interactive flag to true
self.interactive = true
case UIGestureRecognizerState.Changed:
transitionContext.completeTransition(false)
// bug: we have to manually add our 'to view' back http://openradar.appspot.com/radar?
id=5320103646199808
UIApplication.sharedApplication().keyWindow?.addSubview(screens.from.view)
}
else {
transitionContext.completeTransition(true)
// bug: we have to manually add our 'to view' back http://openradar.appspot.com/radar?
id=5320103646199808
UIApplication.sharedApplication().keyWindow?.addSubview(screens.to.view)