Compare commits

...

7 Commits

Author SHA1 Message Date
jonkykong ef1d05607f Updated pod version. 2016-01-05 15:31:11 -08:00
jonkykong aca41e0ed3 Removed unnecessary line of code. 2016-01-05 15:28:33 -08:00
jonkykong 4b07c5ffe5 Update README.md 2016-01-05 15:10:58 -08:00
jonkykong 8305c2f13d Updated asset. 2016-01-05 15:03:39 -08:00
jonkykong 3631570657 Merge branch 'master' of https://github.com/jonkykong/SideMenu
* 'master' of https://github.com/jonkykong/SideMenu:
  Update README.md
2016-01-05 14:33:17 -08:00
jonkykong 74ccc791f8 Refactored UILeft/RightMenuNavigationController into single UIMenuNavigationController class. 2016-01-05 14:33:06 -08:00
jonkykong 374818587a Update README.md 2015-12-29 22:26:27 -08:00
11 changed files with 163 additions and 180 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
PODS:
- SideMenu (0.1.0)
- SideMenu (0.1.2)
DEPENDENCIES:
- SideMenu (from `../`)
@@ -9,6 +9,6 @@ EXTERNAL SOURCES:
:path: ../
SPEC CHECKSUMS:
SideMenu: 62c97561370244e645f3bccecb8a9055f78d0ccc
SideMenu: baaf4e43b0cbddcee96782e5a31399800750b0d7
COCOAPODS: 0.39.0
+4 -3
View File
@@ -1,16 +1,17 @@
{
"name": "SideMenu",
"version": "0.1.0",
"version": "0.1.2",
"summary": "SideMenu is a simple and versatile side menu control.",
"description": "SideMenu is a simple and versatile side menu control. It's highly customizable, but can also be implemented in storyboard without a single line of code. The are three standard animation styles to choose from along with several other options for further customization if desired.",
"description": "SideMenu is a simple and versatile side menu control. It's highly customizable, but can also be implemented in storyboard without a single line of code. The are three standard animation styles to choose from along with several other options for further customization if desired. Just type SideMenuManager.menu... and code completion will show you everything you can customize.",
"homepage": "https://github.com/jonkykong/SideMenu",
"screenshots": "https://raw.githubusercontent.com/jonkykong/SideMenu/master/etc/Preview.gif",
"license": "MIT",
"authors": {
"jonkykong": "jonk@jonked.com"
},
"source": {
"git": "https://github.com/jonkykong/SideMenu.git",
"tag": "0.1.0"
"tag": "0.1.2"
},
"platforms": {
"ios": "8.0"
+2 -2
View File
@@ -1,5 +1,5 @@
PODS:
- SideMenu (0.1.0)
- SideMenu (0.1.2)
DEPENDENCIES:
- SideMenu (from `../`)
@@ -9,6 +9,6 @@ EXTERNAL SOURCES:
:path: ../
SPEC CHECKSUMS:
SideMenu: 62c97561370244e645f3bccecb8a9055f78d0ccc
SideMenu: baaf4e43b0cbddcee96782e5a31399800750b0d7
COCOAPODS: 0.39.0
@@ -14,7 +14,7 @@
buildForArchiving = "YES">
<BuildableReference
BuildableIdentifier = 'primary'
BlueprintIdentifier = '6D5700AB4DD41D539909DBA7'
BlueprintIdentifier = '3D61C28282C06B428D625AC5'
BlueprintName = 'SideMenu'
ReferencedContainer = 'container:Pods.xcodeproj'
BuildableName = 'SideMenu.framework'>
+1 -1
View File
@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.1.0</string>
<string>0.1.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
+9 -5
View File
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="yAA-s6-Bam">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
</dependencies>
@@ -92,7 +93,7 @@
<action selector="changeSegment:" destination="QHN-nZ-kbB" eventType="valueChanged" id="5cv-dF-wWs"/>
</connections>
</segmentedControl>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="0.01" minValue="0.001" maxValue="1" translatesAutoresizingMaskIntoConstraints="NO" id="Xp9-C5-Td1">
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="0.001" minValue="0.001" maxValue="1" translatesAutoresizingMaskIntoConstraints="NO" id="Xp9-C5-Td1">
<rect key="frame" x="18" y="368" width="284" height="31"/>
<color key="thumbTintColor" red="0.25098040700000002" green="0.0" blue="0.50196081400000003" alpha="1" colorSpace="calibratedRGB"/>
<connections>
@@ -242,15 +243,18 @@
</objects>
<point key="canvasLocation" x="142" y="336"/>
</scene>
<!--Left Menu Navigation Controller-->
<!--Menu Navigation Controller-->
<scene sceneID="Zbc-0f-8nT">
<objects>
<navigationController storyboardIdentifier="UILeftMenuNavigationController" navigationBarHidden="YES" id="DuX-EW-0mP" customClass="UILeftMenuNavigationController" customModule="SideMenu" sceneMemberID="viewController">
<navigationController storyboardIdentifier="LeftMenuNavigationController" navigationBarHidden="YES" id="DuX-EW-0mP" customClass="UIMenuNavigationController" customModule="SideMenu" sceneMemberID="viewController">
<navigationItem key="navigationItem" id="ipz-Lx-Wgf"/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="35F-wh-r6h">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="leftSide" value="YES"/>
</userDefinedRuntimeAttributes>
<connections>
<segue destination="V6g-oO-Tbm" kind="relationship" relationship="rootViewController" id="Zvt-Bp-XoT"/>
</connections>
@@ -375,10 +379,10 @@
</objects>
<point key="canvasLocation" x="3896.25" y="0.0"/>
</scene>
<!--Right Menu Navigation Controller-->
<!--Menu Navigation Controller-->
<scene sceneID="kei-0w-mFw">
<objects>
<navigationController storyboardIdentifier="UIRightMenuNavigationController" navigationBarHidden="YES" id="z7k-fk-pfc" customClass="UIRightMenuNavigationController" customModule="SideMenu" sceneMemberID="viewController">
<navigationController storyboardIdentifier="RightMenuNavigationController" navigationBarHidden="YES" id="z7k-fk-pfc" customClass="UIMenuNavigationController" customModule="SideMenu" sceneMemberID="viewController">
<navigationBar key="navigationBar" contentMode="scaleToFill" id="qOd-yQ-2i8">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
+2 -3
View File
@@ -26,8 +26,8 @@ class MainViewController: UIViewController {
private func setupSideMenu() {
// Define the menus
SideMenuManager.menuLeftNavigationController = storyboard!.instantiateViewControllerWithIdentifier("UILeftMenuNavigationController") as? UILeftMenuNavigationController
SideMenuManager.menuRightNavigationController = storyboard!.instantiateViewControllerWithIdentifier("UIRightMenuNavigationController") as? UIRightMenuNavigationController
SideMenuManager.menuLeftNavigationController = storyboard!.instantiateViewControllerWithIdentifier("LeftMenuNavigationController") as? UIMenuNavigationController
SideMenuManager.menuRightNavigationController = storyboard!.instantiateViewControllerWithIdentifier("RightMenuNavigationController") as? UIMenuNavigationController
// Enable gestures. The left and/or right menus must be set up above for these to work.
// Note that these continue to work on the Navigation Controller independent of the View Controller it displays!
@@ -57,7 +57,6 @@ class MainViewController: UIViewController {
}
@IBAction private func changeSegment(segmentControl: UISegmentedControl) {
presentViewController(SideMenuManager.menuLeftNavigationController!, animated: true, completion: nil)
switch segmentControl {
case presentModeSegmentedControl:
let modes:[SideMenuManager.MenuPresentMode] = [.MenuSlideIn, .ViewSlideOut, .MenuDissolveIn]
+133 -157
View File
@@ -12,168 +12,143 @@
SideMenuManager.menuAddScreenEdgePanGesturesToPresent(toView: self.navigationController!.view)
*/
private func menuViewDidAppear(navigationController: UINavigationController) {
// we had presented a view before, so lets dismiss ourselves as already acted upon
if navigationController.view.hidden {
SideMenuManager.hideMenuComplete()
navigationController.dismissViewControllerAnimated(false, completion: { () -> Void in
navigationController.view.hidden = false
})
}
}
private func menuViewWillDisappear(navigationController: UINavigationController) {
// when presenting a view controller from the menu, the menu view gets moved into another transition view above our transition container
// which can break the visual layout we had before. So, we move the menu view back to its original transition view to preserve it.
if !navigationController.isBeingDismissed() {
if let mainView = navigationController.presentingViewController?.view {
switch SideMenuManager.menuPresentMode {
case .ViewSlideOut:
mainView.superview?.insertSubview(navigationController.view, belowSubview: mainView)
case .MenuSlideIn, .MenuDissolveIn:
mainView.superview?.insertSubview(navigationController.view, aboveSubview: SideMenuManager.tapView)
public class UIMenuNavigationController: UINavigationController {
@IBInspectable public var leftSide:Bool = false {
didSet {
if isViewLoaded() { // suppress warnings
didSetSide()
}
}
}
}
private func menuViewDidDisappear(navigationController: UINavigationController) {
// we're presenting a view controller from the menu, so we need to hide the menu so it isn't g when the presented view is dismissed.
if !navigationController.isBeingDismissed() {
navigationController.view.hidden = true
SideMenuManager.hideMenuAppearance()
override public func viewDidLoad() {
super.viewDidLoad()
didSetSide()
}
}
private func menuViewWillTransitionToSize(navigationController: UINavigationController, size: CGSize, coordinator: UIViewControllerTransitionCoordinator) {
// don't bother resizing if the view isn't visible
if navigationController.view.hidden {
return
private func didSetSide() {
if leftSide {
SideMenuManager.menuLeftNavigationController = self
} else {
SideMenuManager.menuRightNavigationController = self
}
}
SideMenuManager.statusBarView?.hidden = true
coordinator.animateAlongsideTransition({ (context) -> Void in
SideMenuManager.presentMenuAppearance(forSize: size)
}) { (context) -> Void in
SideMenuManager.statusBarView?.hidden = false
override public func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
// we had presented a view before, so lets dismiss ourselves as already acted upon
if view.hidden {
SideMenuManager.hideMenuComplete()
dismissViewControllerAnimated(false, completion: { () -> Void in
self.view.hidden = false
})
}
}
}
private func menuPushViewController(navigationController: UINavigationController, viewController: UIViewController, animated: Bool) {
if let menuViewController: UINavigationController = SideMenuManager.presentDirection == .Left ? SideMenuManager.menuLeftNavigationController : SideMenuManager.menuRightNavigationController {
if let presentingViewController = menuViewController.presentingViewController as? UINavigationController {
// to avoid overlapping dismiss & pop/push calls, create a transaction block where the menu
// is dismissed after showing the appropriate screen
CATransaction.begin()
CATransaction.setCompletionBlock( { () -> Void in
navigationController.dismissViewControllerAnimated(true, completion: nil)
navigationController.visibleViewController?.viewWillAppear(false) // Hack: force selection to get cleared on UITableViewControllers when reappearing using custom transitions
})
UIView.animateWithDuration(SideMenuManager.menuAnimationDismissDuration, animations: { () -> Void in
SideMenuManager.hideMenuAppearance()
})
if SideMenuManager.menuAllowPopIfPossible {
for subViewController in presentingViewController.viewControllers {
if subViewController.dynamicType == viewController.dynamicType {
presentingViewController.popToViewController(subViewController, animated: animated)
override public func viewWillDisappear(animated: Bool) {
super.viewWillDisappear(animated)
// when presenting a view controller from the menu, the menu view gets moved into another transition view above our transition container
// which can break the visual layout we had before. So, we move the menu view back to its original transition view to preserve it.
if !isBeingDismissed() {
if let mainView = presentingViewController?.view {
switch SideMenuManager.menuPresentMode {
case .ViewSlideOut:
mainView.superview?.insertSubview(view, belowSubview: mainView)
case .MenuSlideIn, .MenuDissolveIn:
mainView.superview?.insertSubview(view, aboveSubview: SideMenuManager.tapView)
}
}
}
}
override public func viewDidDisappear(animated: Bool) {
super.viewDidDisappear(animated)
// we're presenting a view controller from the menu, so we need to hide the menu so it isn't g when the presented view is dismissed.
if !isBeingDismissed() {
view.hidden = true
SideMenuManager.hideMenuStart()
}
}
override public func viewWillTransitionToSize(size: CGSize, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator) {
super.viewWillTransitionToSize(size, withTransitionCoordinator: coordinator)
// don't bother resizing if the view isn't visible
if view.hidden {
return
}
SideMenuManager.statusBarView?.hidden = true
coordinator.animateAlongsideTransition({ (context) -> Void in
SideMenuManager.presentMenuStart(forSize: size)
}) { (context) -> Void in
SideMenuManager.statusBarView?.hidden = false
}
}
override public func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if let menuViewController: UINavigationController = SideMenuManager.presentDirection == .Left ? SideMenuManager.menuLeftNavigationController : SideMenuManager.menuRightNavigationController,
presentingViewController = menuViewController.presentingViewController as? UINavigationController {
presentingViewController.prepareForSegue(segue, sender: sender)
}
}
override public func shouldPerformSegueWithIdentifier(identifier: String, sender: AnyObject?) -> Bool {
if let menuViewController: UINavigationController = SideMenuManager.presentDirection == .Left ? SideMenuManager.menuLeftNavigationController : SideMenuManager.menuRightNavigationController,
presentingViewController = menuViewController.presentingViewController as? UINavigationController {
return presentingViewController.shouldPerformSegueWithIdentifier(identifier, sender: sender)
}
return super.shouldPerformSegueWithIdentifier(identifier, sender: sender)
}
override public func pushViewController(viewController: UIViewController, animated: Bool) {
if let menuViewController: UINavigationController = SideMenuManager.presentDirection == .Left ? SideMenuManager.menuLeftNavigationController : SideMenuManager.menuRightNavigationController {
if let presentingViewController = menuViewController.presentingViewController as? UINavigationController {
// to avoid overlapping dismiss & pop/push calls, create a transaction block where the menu
// is dismissed after showing the appropriate screen
CATransaction.begin()
CATransaction.setCompletionBlock( { () -> Void in
self.dismissViewControllerAnimated(true, completion: nil)
self.visibleViewController?.viewWillAppear(false) // Hack: force selection to get cleared on UITableViewControllers when reappearing using custom transitions
})
UIView.animateWithDuration(SideMenuManager.menuAnimationDismissDuration, animations: { () -> Void in
SideMenuManager.hideMenuStart()
})
if SideMenuManager.menuAllowPopIfPossible {
for subViewController in presentingViewController.viewControllers {
if subViewController.dynamicType == viewController.dynamicType {
presentingViewController.popToViewController(subViewController, animated: animated)
CATransaction.commit()
return
}
}
}
if !SideMenuManager.menuAllowPushOfSameClassTwice {
if presentingViewController.viewControllers.last?.dynamicType == viewController.dynamicType {
CATransaction.commit()
return
}
}
presentingViewController.pushViewController(viewController, animated: animated)
CATransaction.commit()
} else {
menuViewController.presentViewController(viewController, animated: animated, completion: nil)
print("Warning: attempted to push a ViewController from a ViewController that doesn't have a NavigationController. It will be presented it instead.")
}
if !SideMenuManager.menuAllowPushOfSameClassTwice {
if presentingViewController.viewControllers.last?.dynamicType == viewController.dynamicType {
CATransaction.commit()
return
}
}
presentingViewController.pushViewController(viewController, animated: animated)
CATransaction.commit()
} else {
menuViewController.presentViewController(viewController, animated: animated, completion: nil)
print("Warning: attempted to push a ViewController from a ViewController that doesn't have a NavigationController. It will be presented it instead.")
}
}
}
public class UILeftMenuNavigationController: UINavigationController {
override public func viewDidLoad() {
super.viewDidLoad()
SideMenuManager.menuLeftNavigationController = self
}
override public func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
menuViewDidAppear(self)
}
override public func viewWillDisappear(animated: Bool) {
super.viewWillDisappear(animated)
menuViewWillDisappear(self)
}
override public func viewDidDisappear(animated: Bool) {
super.viewDidDisappear(animated)
menuViewDidDisappear(self)
}
override public func viewWillTransitionToSize(size: CGSize, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator) {
super.viewWillTransitionToSize(size, withTransitionCoordinator: coordinator)
menuViewWillTransitionToSize(self, size: size, coordinator: coordinator)
}
override public func pushViewController(viewController: UIViewController, animated: Bool) {
menuPushViewController(self, viewController: viewController, animated: animated)
}
}
public class UIRightMenuNavigationController: UINavigationController {
override public func viewDidLoad() {
super.viewDidLoad()
SideMenuManager.menuRightNavigationController = self
}
override public func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
menuViewDidAppear(self)
}
override public func viewWillDisappear(animated: Bool) {
super.viewWillDisappear(animated)
menuViewWillDisappear(self)
}
override public func viewDidDisappear(animated: Bool) {
super.viewDidDisappear(animated)
menuViewDidDisappear(self)
}
override public func viewWillTransitionToSize(size: CGSize, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator) {
super.viewWillTransitionToSize(size, withTransitionCoordinator: coordinator)
menuViewWillTransitionToSize(self, size: size, coordinator: coordinator)
}
override public func pushViewController(viewController: UIViewController, animated: Bool) {
menuPushViewController(self, viewController: viewController, animated: animated)
}
}
public class SideMenuManager: UIPercentDrivenInteractiveTransition, UIViewControllerAnimatedTransitioning, UIViewControllerTransitioningDelegate {
public enum MenuPresentMode {
@@ -218,7 +193,7 @@ public class SideMenuManager: UIPercentDrivenInteractiveTransition, UIViewContro
// prevent instantiation
private override init() {}
public static var menuLeftNavigationController: UILeftMenuNavigationController? {
public static var menuLeftNavigationController: UIMenuNavigationController? {
willSet {
if menuLeftNavigationController != nil {
let originalBlurEffectStyle = menuBlurEffectStyle
@@ -239,7 +214,7 @@ public class SideMenuManager: UIPercentDrivenInteractiveTransition, UIViewContro
}
}
public static var menuRightNavigationController: UIRightMenuNavigationController? {
public static var menuRightNavigationController: UIMenuNavigationController? {
willSet {
if menuRightNavigationController != nil {
let originalBlurEffectStyle = menuBlurEffectStyle
@@ -464,7 +439,7 @@ public class SideMenuManager: UIPercentDrivenInteractiveTransition, UIViewContro
return viewController
}
private class func hideMenuAppearance() {
private class func hideMenuStart() {
let mainViewController = viewControllerForPresentedMenu!
let menuView = presentDirection == .Left ? menuLeftNavigationController!.view : menuRightNavigationController!.view
menuView.transform = CGAffineTransformIdentity
@@ -510,7 +485,7 @@ public class SideMenuManager: UIPercentDrivenInteractiveTransition, UIViewContro
}
}
private class func presentMenuAppearance(forSize size: CGSize = UIScreen.mainScreen().bounds.size) {
private class func presentMenuStart(forSize size: CGSize = UIScreen.mainScreen().bounds.size) {
let mainViewController = viewControllerForPresentedMenu!
if let menuView = presentDirection == .Left ? menuLeftNavigationController?.view : menuRightNavigationController?.view {
menuView.transform = CGAffineTransformIdentity
@@ -574,6 +549,8 @@ public class SideMenuManager: UIPercentDrivenInteractiveTransition, UIViewContro
// animate a change from one viewcontroller to another
public func animateTransition(transitionContext: UIViewControllerContextTransitioning) {
let statusBarStyle = SideMenuManager.visibleViewController()?.preferredStatusBarStyle()
// get reference to our fromView, toView and the container view that we should perform the transition in
let container = transitionContext.containerView()!
if let menuBackgroundColor = SideMenuManager.menuAnimationBackgroundColor {
@@ -627,7 +604,7 @@ public class SideMenuManager: UIPercentDrivenInteractiveTransition, UIViewContro
}
SideMenuManager.tapView = tapView
SideMenuManager.hideMenuAppearance() // offstage for interactive
SideMenuManager.hideMenuStart() // offstage for interactive
NSNotificationCenter.defaultCenter().addObserver(SideMenuManager.singleton, selector:"applicationDidEnterBackgroundNotification", name: UIApplicationDidEnterBackgroundNotification, object: nil)
}
@@ -637,16 +614,15 @@ public class SideMenuManager: UIPercentDrivenInteractiveTransition, UIViewContro
let options: UIViewAnimationOptions = SideMenuManager.interactive ? .CurveLinear : .CurveEaseInOut
UIView.animateWithDuration(duration, delay: 0, options: options, animations: { () -> Void in
if SideMenuManager.presenting {
SideMenuManager.presentMenuAppearance() // onstage items: slide in
SideMenuManager.presentMenuStart() // onstage items: slide in
}
else {
SideMenuManager.hideMenuAppearance()
SideMenuManager.hideMenuStart()
}
}) { (finished) -> Void in
// if UIApplication.sharedApplication().visibleViewController!.preferredStatusBarStyle() != statusBarStyle {
// // See http://www.openradar.me/21961293
// print("Warning: do not change the status bar style while using interactive transitions or you risk transitions not properly completing.")
// }
if SideMenuManager.visibleViewController()?.preferredStatusBarStyle() != statusBarStyle {
print("Warning: do not change the status bar style while using custom transitions or you risk transitions not properly completing and locking up the UI. See http://www.openradar.me/21961293")
}
// tell our transitionContext object that we've finished animating
if transitionContext.transitionWasCancelled() {
if SideMenuManager.presenting {
@@ -708,7 +684,7 @@ public class SideMenuManager: UIPercentDrivenInteractiveTransition, UIViewContro
func applicationDidEnterBackgroundNotification() {
if let menuViewController: UINavigationController = SideMenuManager.presentDirection == .Left ? SideMenuManager.menuLeftNavigationController : SideMenuManager.menuRightNavigationController {
SideMenuManager.hideMenuAppearance()
SideMenuManager.hideMenuStart()
SideMenuManager.hideMenuComplete()
menuViewController.dismissViewControllerAnimated(false, completion: nil)
}
+7 -4
View File
@@ -25,9 +25,11 @@ pod "SideMenu"
SideMenu is highly customizable, but can also be implemented in storyboard without a single line of code. Check out the example project to see it in action.
### Storyboard
1. Create a Navigation Controller. Set the custom class of the Navigation Controller to be `UILeftMenuNavigationController` or `UIRightMenuNavigationController` (whichever you prefer) in the **Identity Inspector**.
![](etc/Screenshot.png)
1. Create a Navigation Controller for a side menu. Set the custom class of the Navigation Controller to be `UIMenuNavigationController` in the **Identity Inspector**. Set its `Left Side` property to On if you want it to appear from the left side of the screen, or Off/Default if you want it to appear from the right side.
2. Create a root View Controller for the Navigation Controller in step 1. Set up any Triggered Segues you want in that View Controller.
3. From any View Controller, add a UIButton or UIBarButton. Set that button's Triggered Segues action to modally present the Navigation Controller from step 1.
3. From a View Controller you want to display the side menu from, add a UIButton or UIBarButton. Set that button's Triggered Segues action to modally present the Navigation Controller from step 1.
*Note: you can only enable gestures with code.*
@@ -35,10 +37,11 @@ SideMenu is highly customizable, but can also be implemented in storyboard witho
In your View Controller's `viewDidLoad` event, do something like this:
``` swift
// Define the menus
let leftMenuNavigationController = UILeftMenuNavigationController()
let leftMenuNavigationController = UIMenuNavigationController()
leftMenuNavigationController.leftSide = true
// UILeftMenuNavigationController is a subclass of UINavigationController, so do any additional configuration of it here
SideMenuManager.menuLeftNavigationController = leftMenuNavigationController
let rightMenuNavigationController = UIRightMenuNavigationController()
let rightMenuNavigationController = UIMenuNavigationController()
// UIRightMenuNavigationController is a subclass of UINavigationController, so do any additional configuration of it here
SideMenuManager.menuRightNavigationController = rightMenuNavigationController
+2 -2
View File
@@ -8,7 +8,7 @@
Pod::Spec.new do |s|
s.name = "SideMenu"
s.version = "0.1.0"
s.version = "0.1.2"
s.summary = "SideMenu is a simple and versatile side menu control."
# This description is used to generate tags and improve search results.
@@ -21,7 +21,7 @@ Pod::Spec.new do |s|
DESC
s.homepage = "https://github.com/jonkykong/SideMenu"
# s.screenshots = "www.example.com/screenshots_1", "www.example.com/screenshots_2"
s.screenshot = "https://raw.githubusercontent.com/jonkykong/SideMenu/master/etc/Preview.gif"
s.license = 'MIT'
s.author = { "jonkykong" => "jonk@jonked.com" }
s.source = { :git => "https://github.com/jonkykong/SideMenu.git", :tag => s.version.to_s }
Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB