Git Product home page Git Product logo

sidemenu's Introduction

▤ SideMenu

CircleCI Version Carthage compatible License Platform

If you like SideMenu, give it a ★ at the top right of this page.

SideMenu needs your help! If you're a skilled iOS developer and want to help maintain this repository and answer issues asked by the community, please send me an email.

Hi, I'm Jon Kent and I am an iOS designer, developer, and mobile strategist. I love coffee and play the drums.

  • Hire me to help you make cool stuff. Note: If you're having a problem with SideMenu, please open an issue and do not email me.
  • Check out my website to see some of my other projects.
  • Building and maintaining this free library takes a lot of my time and saves you time. Please consider paying it forward by supporting me with a small amount to my PayPal. (only 13 people have donated since 12/23/15 but thank you to those who have!)

Overview

SideMenu is a simple and versatile side menu control written in Swift.

  • It can be implemented in storyboard without a single line of code.
  • Eight standard animation styles to choose from (there's even a parallax effect if you want to get weird).
  • Highly customizable without needing to write tons of custom code.
  • Supports continuous swiping between side menus on boths sides in a single gesture.
  • Global menu configuration. Set-up once and be done for all screens.
  • Menus can be presented and dismissed the same as any other view controller since this control uses custom transitions.
  • Animations use your view controllers, not snapshots.
  • Properly handles screen rotation and in-call status bar height changes.

Check out the example project to see it in action!

Preview Samples

Slide Out Slide In Dissolve Slide In + Out

Requirements

  • Xcode 11.
  • Swift 5.
  • iOS 10 or higher.

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

To integrate SideMenu into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!

pod 'SideMenu'

# For Swift 5 use:
# pod 'SideMenu', '~> 6.0'

# For Swift 4.2 (no longer maintained) use:
# pod 'SideMenu', '~> 5.0'

Then, run the following command:

$ pod install

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate SideMenu into your Xcode project using Carthage, specify it in your Cartfile:

github "jonkykong/SideMenu" "master"

Swift Package Manager

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler. It is in early development, but SideMenu does support its use on supported platforms.

Once you have your Swift package set up, adding SideMenu as a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies: [
    .package(url: "https://github.com/jonkykong/SideMenu.git", from: "6.0.0")
]

Usage

Code-less Storyboard Implementation

  1. Create a Navigation Controller for a side menu. Set the Custom Class of the Navigation Controller to be SideMenuNavigationController in the Identity Inspector. Set the Module to SideMenu (ignore this step if you've manually added SideMenu to your project). Create a Root View Controller for the Navigation Controller (shown as a UITableViewController below). Set up any Triggered Segues you want in that view controller.

  2. Set the Left Side property of the SideMenuNavigationController 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.

  3. Add a UIButton or UIBarButton to a view controller that you want to display the menu from. Set that button's Triggered Segues action to modally present the Navigation Controller from step 1.

That's it. Note: you can only enable gestures in code.

Code Implementation

First:

import SideMenu

From a button, do something like this:

// Define the menu
let menu = SideMenuNavigationController(rootViewController: YourViewController)
// SideMenuNavigationController is a subclass of UINavigationController, so do any additional configuration 
// of it here like setting its viewControllers. If you're using storyboards, you'll want to do something like:
// let menu = storyboard!.instantiateViewController(withIdentifier: "RightMenu") as! SideMenuNavigationController
present(menu, animated: true, completion: nil)

To dismiss a menu programmatically, do something like this:

dismiss(animated: true, completion: nil)

To use gestures you have to use the SideMenuManager. In your AppDelegate do something like this:

// Define the menus
let leftMenuNavigationController = SideMenuNavigationController(rootViewController: YourViewController)
SideMenuManager.default.leftMenuNavigationController = leftMenuNavigationController

let rightMenuNavigationController = SideMenuNavigationController(rootViewController: YourViewController)
SideMenuManager.default.rightMenuNavigationController = rightMenuNavigationController

// Setup 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!
SideMenuManager.default.addPanGestureToPresent(toView: self.navigationController!.navigationBar)
SideMenuManager.default.addScreenEdgePanGesturesToPresent(toView: self.navigationController!.view)

// (Optional) Prevent status bar area from turning black when menu appears:
leftMenuNavigationController.statusBarEndAlpha = 0
// Copy all settings to the other menu
rightMenuNavigationController.settings = leftMenuNavigationController.settings

That's it.

Customization

SideMenuManager

SideMenuManager supports the following:

/// The left menu.
open var leftMenuNavigationController: SideMenuNavigationController?
/// The right menu.
public var rightMenuNavigationController: SideMenuNavigationController?
/**
 Adds screen edge gestures for both left and right sides to a view to present a menu.

 - Parameter toView: The view to add gestures to.

 - Returns: The array of screen edge gestures added to `toView`.
 */
@discardableResult public func addScreenEdgePanGesturesToPresent(toView view: UIView) -> [UIScreenEdgePanGestureRecognizer]
/**
 Adds screen edge gestures to a view to present a menu.

 - Parameter toView: The view to add gestures to.
 - Parameter forMenu: The menu (left or right) you want to add a gesture for.

 - Returns: The screen edge gestures added to `toView`.
 */
@discardableResult public func addScreenEdgePanGesturesToPresent(toView view: UIView, forMenu side: PresentDirection) -> UIScreenEdgePanGestureRecognizer
/**
 Adds a pan edge gesture to a view to present menus.

 - Parameter toView: The view to add a pan gesture to.

 - Returns: The pan gesture added to `toView`.
 */
@discardableResult public func addPanGestureToPresent(toView view: UIView) -> UIPanGestureRecognizer

SideMenuNavigationController

SideMenuNavigationController supports the following:

/// Prevents the same view controller (or a view controller of the same class) from being pushed more than once. Defaults to true.
var allowPushOfSameClassTwice: Bool = true
/// Forces menus to always animate when appearing or disappearing, regardless of a pushed view controller's animation.
var alwaysAnimate: Bool = true
/// The animation options when a menu is displayed. Ignored when displayed with a gesture.
var animationOptions: UIView.AnimationOptions = .curveEaseInOut
/**
 The blur effect style of the menu if the menu's root view controller is a UITableViewController or UICollectionViewController.

 - Note: If you want cells in a UITableViewController menu to show vibrancy, make them a subclass of UITableViewVibrantCell.
 */
var blurEffectStyle: UIBlurEffect.Style? = nil
/// Duration of the remaining animation when the menu is partially dismissed with gestures. Default is 0.35 seconds.
var completeGestureDuration: Double = 0.35
/// Animation curve of the remaining animation when the menu is partially dismissed with gestures. Default is .easeIn.
var completionCurve: UIView.AnimationCurve = .curveEaseInOut
/// Duration of the animation when the menu is dismissed without gestures. Default is 0.35 seconds.
var dismissDuration: Double = 0.35
/// Automatically dismisses the menu when another view is presented from it.
var dismissOnPresent: Bool = true
/// Automatically dismisses the menu when another view controller is pushed from it.
var dismissOnPush: Bool = true
/// Automatically dismisses the menu when the screen is rotated.
var dismissOnRotation: Bool = true
/// Automatically dismisses the menu when app goes to the background.
var dismissWhenBackgrounded: Bool = true
/// Enable or disable a swipe gesture that dismisses the menu. Will not be triggered when `presentingViewControllerUserInteractionEnabled` is set to true. Default is true.
var enableSwipeToDismissGesture: Bool = true
/// Enable or disable a tap gesture that dismisses the menu. Will not be triggered when `presentingViewControllerUserInteractionEnabled` is set to true. Default is true.
var enableTapToDismissGesture: Bool = true
/// The animation initial spring velocity when a menu is displayed. Ignored when displayed with a gesture.
var initialSpringVelocity: CGFloat = 1
/// Whether the menu appears on the right or left side of the screen. Right is the default. This property cannot be changed after the menu has loaded.
var leftSide: Bool = false
/// Width of the menu when presented on screen, showing the existing view controller in the remaining space. Default is zero.
var menuWidth: CGFloat = 240
/// Duration of the animation when the menu is presented without gestures. Default is 0.35 seconds.
var presentDuration: Double = 0.35
/// Enable or disable interaction with the presenting view controller while the menu is displayed. Enabling may make it difficult to dismiss the menu or cause exceptions if the user tries to present and already presented menu. `presentingViewControllerUseSnapshot` must also set to false. Default is false.
var presentingViewControllerUserInteractionEnabled: Bool = false
/// Use a snapshot for the presenting vierw controller while the menu is displayed. Useful when layout changes occur during transitions. Not recommended for apps that support rotation. Default is false.
var presentingViewControllerUseSnapshot: Bool = false
/// The presentation style of the menu.
var presentationStyle: SideMenuPresentStyle = .viewSlideOut
/**
 The push style of the menu.

 There are six modes in MenuPushStyle:
 - defaultBehavior: The view controller is pushed onto the stack.
 - popWhenPossible: If a view controller already in the stack is of the same class as the pushed view controller, the stack is instead popped back to the existing view controller. This behavior can help users from getting lost in a deep navigation stack.
 - preserve: If a view controller already in the stack is of the same class as the pushed view controller, the existing view controller is pushed to the end of the stack. This behavior is similar to a UITabBarController.
 - preserveAndHideBackButton: Same as .preserve and back buttons are automatically hidden.
 - replace: Any existing view controllers are released from the stack and replaced with the pushed view controller. Back buttons are automatically hidden. This behavior is ideal if view controllers require a lot of memory or their state doesn't need to be preserved..
 - subMenu: Unlike all other behaviors that push using the menu's presentingViewController, this behavior pushes view controllers within the menu.  Use this behavior if you want to display a sub menu.
 */
var pushStyle: MenuPushStyle = .default
/// Draws `presentationStyle.backgroundColor` behind the status bar. Default is 0.
var statusBarEndAlpha: CGFloat = 0
/// The animation spring damping when a menu is displayed. Ignored when displayed with a gesture.
var usingSpringWithDamping: CGFloat = 1
/// Indicates if the menu is anywhere in the view hierarchy, even if covered by another view controller.
var isHidden: Bool

SideMenuPresentStyle

There are 8 pre-defined SideMenuPresentStyle options:

/// Menu slides in over the existing view.
static let menuSlideIn: SideMenuPresentStyle
/// The existing view slides out to reveal the menu underneath.
static let viewSlideOut: SideMenuPresentStyle
/// The existing view slides out while the menu slides in.
static let viewSlideOutMenuIn: SideMenuPresentStyle
/// The menu dissolves in over the existing view.
static let menuDissolveIn: SideMenuPresentStyle
/// The existing view slides out while the menu partially slides in.
static let viewSlideOutMenuPartialIn: SideMenuPresentStyle
/// The existing view slides out while the menu slides out from under it.
static let viewSlideOutMenuOut: SideMenuPresentStyle
/// The existing view slides out while the menu partially slides out from under it.
static let viewSlideOutMenuPartialOut: SideMenuPresentStyle
/// The existing view slides out and shrinks to reveal the menu underneath.
static let viewSlideOutMenuZoom: SideMenuPresentStyle

SideMenuNavigationControllerDelegate

To receive notifications when a menu is displayed from a view controller, have it adhere to the SideMenuNavigationControllerDelegate protocol:

extension MyViewController: SideMenuNavigationControllerDelegate {

    func sideMenuWillAppear(menu: SideMenuNavigationController, animated: Bool) {
        print("SideMenu Appearing! (animated: \(animated))")
    }

    func sideMenuDidAppear(menu: SideMenuNavigationController, animated: Bool) {
        print("SideMenu Appeared! (animated: \(animated))")
    }

    func sideMenuWillDisappear(menu: SideMenuNavigationController, animated: Bool) {
        print("SideMenu Disappearing! (animated: \(animated))")
    }

    func sideMenuDidDisappear(menu: SideMenuNavigationController, animated: Bool) {
        print("SideMenu Disappeared! (animated: \(animated))")
    }
}

Note: setting the sideMenuDelegate property on SideMenuNavigationController is optional. If your view controller adheres to the protocol then the methods will be called automatically.

Advanced

Click for Details

Multiple SideMenuManagers

For simplicity, SideMenuManager.default serves as the primary instance as most projects will only need one menu across all screens. If you need to show a different SideMenu using gestures, such as from a modal view controller presented from a previous SideMenu, do the following:

  1. Declare a variable containing your custom SideMenuManager instance. You may want it to define it globally and configure it in your app delegate if menus will be used on multiple screens.
let customSideMenuManager = SideMenuManager()
  1. Setup and display menus with your custom instance the same as you would with the SideMenuManager.default instance.
  2. If using Storyboards, subclass your instance of SideMenuNavigationController and set its sideMenuManager property to your custom instance. This must be done before viewDidLoad is called:
class MySideMenuNavigationController: SideMenuNavigationController {

    let customSideMenuManager = SideMenuManager()

    override func awakeFromNib() {
        super.awakeFromNib()

        sideMenuManager = customSideMenuManager
    }
}

Alternatively, you can set sideMenuManager from the view controller that segues to your SideMenuNavigationController:

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    if let sideMenuNavigationController = segue.destination as? SideMenuNavigationController {
        sideMenuNavigationController.sideMenuManager = customSideMenuManager
    }
}

Important: displaying SideMenu instances directly over each other is not supported. Use menuPushStyle = .subMenu to display multi-level menus instead.

SideMenuPresentationStyle

If you want to create your own custom presentation style, create a subclass of SideMenuPresentationStyle and set your menu's presentationStyle to it:

class MyPresentStyle: SideMenuPresentationStyle {

    override init() {
        super.init()
        /// Background color behind the views and status bar color
        backgroundColor = .black
        /// The starting alpha value of the menu before it appears
        menuStartAlpha = 1
        /// Whether or not the menu is on top. If false, the presenting view is on top. Shadows are applied to the view on top.
        menuOnTop = false
        /// The amount the menu is translated along the x-axis. Zero is stationary, negative values are off-screen, positive values are on screen.
        menuTranslateFactor = 0
        /// The amount the menu is scaled. Less than one shrinks the view, larger than one grows the view.
        menuScaleFactor = 1
        /// The color of the shadow applied to the top most view.
        onTopShadowColor = .black
        /// The radius of the shadow applied to the top most view.
        onTopShadowRadius = 5
        /// The opacity of the shadow applied to the top most view.
        onTopShadowOpacity = 0
        /// The offset of the shadow applied to the top most view.
        onTopShadowOffset = .zero
        /// The ending alpha of the presenting view when the menu is fully displayed.
        presentingEndAlpha = 1
        /// The amount the presenting view is translated along the x-axis. Zero is stationary, negative values are off-screen, positive values are on screen.
        presentingTranslateFactor = 0
        /// The amount the presenting view is scaled. Less than one shrinks the view, larger than one grows the view.
        presentingScaleFactor = 1
        /// The strength of the parallax effect on the presenting view once the menu is displayed.
        presentingParallaxStrength = .zero
    }

    /// This method is called just before the presentation transition begins. Use this to setup any animations. The super method does not need to be called.
    override func presentationTransitionWillBegin(to presentedViewController: UIViewController, from presentingViewController: UIViewController) {}
    /// This method is called during the presentation animation. Use this to animate anything alongside the menu animation. The super method does not need to be called.
    override func presentationTransition(to presentedViewController: UIViewController, from presentingViewController: UIViewController) {}
    /// This method is called when the presentation transition ends. Use this to finish any animations. The super method does not need to be called.
    override func presentationTransitionDidEnd(to presentedViewController: UIViewController, from presentingViewController: UIViewController, _ completed: Bool) {}
    /// This method is called just before the dismissal transition begins. Use this to setup any animations. The super method does not need to be called.
    override func dismissalTransitionWillBegin(to presentedViewController: UIViewController, from presentingViewController: UIViewController) {}
    /// This method is called during the dismissal animation. Use this to animate anything alongside the menu animation. The super method does not need to be called.
    override func dismissalTransition(to presentedViewController: UIViewController, from presentingViewController: UIViewController) {}
    /// This method is called when the dismissal transition ends. Use this to finish any animations. The super method does not need to be called.
    override func dismissalTransitionDidEnd(to presentedViewController: UIViewController, from presentingViewController: UIViewController, _ completed: Bool) {}
}

Known Issues

  • Issue #258. Using presentingViewControllerUseSnapshot can help preserve the experience.

Thank You

A special thank you to everyone that has contributed to this library to make it better. Your support is appreciated!

License

SideMenu is available under the MIT license. See the LICENSE file for more info.

sidemenu's People

Contributors

akukla avatar alexbumbu avatar alghanor avatar alkozin avatar apozdeyev avatar arturazarau avatar auramagi avatar av0c0der avatar carlosgarciapecun avatar cipi1965 avatar cloutas avatar herrernst avatar iranjith4 avatar isavynskyi avatar jlukanta avatar jonkykong avatar joshfriend avatar leoneparise avatar mark-urbanthings avatar moldovaniosif avatar mrackwitz avatar mykolaleobit avatar ogezue avatar olcayertas avatar petkrein avatar rafaelfrancisco-dev avatar saltyskip avatar soheilbm avatar thang2410199 avatar valeriyvan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sidemenu's Issues

when useing "QLPreviewController" with SideMenu...

it can't touch right part to shutdown SideMenu.

当使用QLPreviewController放在我的Controller里时,拉出SideMenu,不能点击右侧遮罩处关闭SideMenu。因为能直接操作QLPreviewController。

Call Side Menu in Each Child View Controller

Hi jonkykong, your side menu is awesome, looks really smooth and responsive. My purpose is to build a menu similar to that of Lyft or Uber: each child view controller should be able to call this menu independently without a intermediate step to go back to "home" screen. In your example, each child view controller is triggered by a push segue but then the menu button just redirects me to the main screen instead of the menu. In my own code, I used
presentViewController(SideMenuManager.menuLeftNavigationController!, animated: true, completion: nil)
for the menu button but the automatic generated "back" button will always should on the top of my menu button to prevent me from doing the right thing and then I will go back to the initial screen... Is there any neat way to make your menu behave like a normal slide-out menu?

Dismiss left view

How can I dismiss my left view without poping or pushing my main view controller?

fatal error: unexpectedly found nil while unwrapping an Optional value

I have successfully implemented SideMenu by following the steps in the GitHub page. It's Working fine. But amGetting this error right now. So When It occurred...

I have Different items to display in my Menu list like , Home , Profile , Log Out etc..
for that I am using different cells and created segue's from each cell . The First Screen to Display when i run the project is the Home Screen. Then using a Button or gesture I revealed the SideMenu and from the Items in the Menu when I click on the Cell which Navigates back to home I get the error mentioned in the title inside the function hideMenuStart at this line
let mainViewController = SideMenuTransition.viewControllerForPresentedMenu! ... How to fix this.. I am new to iOS...

fatal error: unexpectedly found nil while unwrapping an Optional value rotating device

Hi,
i'm very glad to use SideMenu, it looks fantastic!

During testing of my app, the line in presentMenuStart func:
let mainViewController = SideMenuTransition.viewControllerForPresentedMenu!

Cause an EXC_BAD_INSTRUCTION error when i rotate the device. Looking at issues, i tried to update pod and to init menu in AppDelegate without solving the problem.

Thanks

*** IMPORTANT: PLEASE READ BEFORE YOU OPEN A NEW ISSUE! ***

Thank you for your interest in SideMenu!

I have received a surprising amount of questions about SideMenu since putting it up here. A few people in the community have identified some problems and helped contribute to SideMenu to make it better for everyone and I'm truly grateful for the support! Keep them coming!

I have also received a number of questions about people having issues implementing SideMenu, mostly from beginners learning how to code. As much as I would love to help all of you, I simply do not have the time to teach you. That's why I spent a lot of time putting together a detailed README, adding comments about usage in code, and providing a demo project. These will give you all the information you need to work through any problem and also save me the time it takes to personally respond. It is faster for you to figure it out for yourself instead of waiting for me to respond to you.

If your question begins with "How do I..."

  • It's not a bug. Stay persistent, try a few different things, and you will figure it out! I also recommend searching and posting your questions on stackoverflow.com. Or, if you're interested in hiring me to teach you, please email me using the email address listed at the bottom of my README.

If your question begins with "Can I..."

  • That's a new feature request. I am no longer investing my personal time to implement one-off features because SideMenu currently meets the majority of people's needs with the features it already has. However, this is a great opportunity for you to contribute to this open source project! Feel free to open an issue to ask any clarifying questions for your new feature before you start building. Open a pull request when you're ready for me to merge it.

Again, please do not email me or open any issues if you want to know how to use SideMenu or are having trouble getting it to work. However, if you think you found a bug, open an issue and I will respond to it as quickly as I can. You should be able to demonstrate the bug in the demo project which has a minimal amount of code.

Thanks again for your support and for being respectful of my time.

Functionality in landscape mode?

Hey,

The SideMenu has been working great. I have a tableView with static cells for my sidemenu, however, when I'm in landscape mode the menu doesn't scroll so the bottom part is inaccessible. I know the entire menu won't fit on screen in landscape but do you have a recommendation on how to make it so it will scroll in landscape?

Thanks!

Having problem with split view controller

When attempting to push a view from the sideBarTableView controller, there is an error

SideMenu Warning: cannot push a ViewController from a ViewController without a NavigationController. It will be presented it instead.

attached a sample setup below

screen shot 2016-07-20 at 2 51 15 pm

How to properly make a push segue from the SideMenu

Hello,

Thank you for this ready-to-use pod !

I am displaying a static table view in the sidemenu. I would like to perform a push segue from a cell of the SideMenu.

How and where can I implement a Navigation Controller to perform a push segue ?

Thanks !

Here is my code :

override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
    let cell = tableView.cellForRowAtIndexPath(indexPath)

    // get cell identifier if it exists (otherwise, quit the function)
    guard let cellIdentifier = cell?.reuseIdentifier else {return}

    switch cellIdentifier {


    case "settings":
        performSegueWithIdentifier("SettingsSegue", sender: self)

    case "help":
        if let url = NSURL(string: "http://www.google.com/") {
            UIApplication.sharedApplication().openURL(url)
        }

    case "signout":
            performSegueWithIdentifier("SignInSegue", sender: self)

    case "deleteaccount":
            performSegueWithIdentifier("SignInSegue", sender: self)

    default: break

    }
 }

Black Strip Top

2016-07-19 8 13 20

2016-07-19 8 13 08

I use the method in Storyboard but it has that small black area that disturbs me and I don't know how to get rid of it. I have also tried your programmatically implementing method which gives the same result. Is it a common issue?

Wrong MainViewController frame after rotation

If we rotate device while SideMenu is on screen with MenuPresentMode equals to InOut & MenuTransformScaleFactor equals to less than 1 we'll catch a bug: MainViewController will be cut out his height.

Dim presenting view when menu is showing

When the menu is shown, I want to dim the presenting view by changing its background color. I am happy to submit a PR for this. There are two ways we could do this:

  • Add a property like menuContainerBackgroundColor property to SideMenuManager. Then it would handle the presenting view background color change as part of its animation.
  • Add a delegate to SideMenuManager. It would call a method in the delegate when it is presented or dismissed. This allows us to animate the background color changes by responding to the delegate methods and animating using menuAnimationPresentDuration or menuAnimationDismissDuration for the duration.

Any preference?

barPosition Error

When I make click on the bottom for display the menu, show me the following error:

Failed to set (barPosition) user defined inspected property on (UINavigationItem): [<UINavigationItem 0x13dd98d60> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key barPosition.

Any Help?

Visual glitch when sliding to close

Hi!

There's a visual glitch when you close either one of the side menus by swiping as if you were throwing the menu way. In other words, beginning the swipe and releasing the finger before the menu is fully closed.

Setting Swipe Gestures to Nil Doesn't Disable Swipe Gesture

        conversationsViewController.conversationsViewControllerDelegate = self
        SideMenuManager.menuLeftNavigationController = conversationsViewController
        SideMenuManager.menuPresentMode = .ViewSlideInOut
        SideMenuManager.menuFadeStatusBar = false
        SideMenuManager.menuWidth = max(round(min(UIScreen.mainScreen().bounds.width, UIScreen.mainScreen().bounds.height) * 0.85), 240)
        SideMenuManager.menuShadowOpacity = 0
        SideMenuManager.menuRightSwipeToDismissGesture = nil
        SideMenuManager.menuLeftSwipeToDismissGesture = nil
        SideMenuManager.menuAnimationPresentDuration = 0.25
        SideMenuManager.menuAnimationDismissDuration = 0.25

As you can see I've set both swipe gestures to nil however, I'm still able to swipe and dismiss the controller. What am I doing wrong?

How to open side menu programmatically?

Hello. Thank you for library.

Can not understand what the correct way to open side menu from code.

Tried use some segue from root view controller and performSegueWithIdentifier(_:_:) but menu just opened modally.

Thanks in advance.

Application crashes after touch home button

Application crashes for me after touching home button.In SideMenuTransition.hideMenuStart() SideMenuTransition.viewControllerForPresentedMenu! controller is nil.
My init looks like:

 let leftViewController:UISideMenuNavigationController = UIStoryboard(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("UISideMenuNavigationController") as! UISideMenuNavigationController
         SideMenuManager.menuLeftNavigationController = leftViewController
        SideMenuManager.menuAddScreenEdgePanGesturesToPresent(toView: self.view)
        SideMenuManager.menuPresentMode = .MenuSlideIn
        SideMenuManager.menuAnimationBackgroundColor = UIColor.clearColor()

Transition with disabled rotation/limited supported orientation

Steps to reproduce:

For easy demonstration, I'm using example project in SideMenu directory.

  • Open Example/SideMenu.xcworkspace
  • Create new subclass of UINavigationController
  • Set Initial Navigation Controller in Main.storyboard as type of this new subclass
  • Add this code to new created subclass of UINavigationController (This should simulate use case for programmatically set up rotation lock or different supported interface orientations for different devices e.g. iPhone only Portrait, for iPad Portrait and Landscape)
    override func shouldAutorotate() -> Bool {
        return false
    }
  • Launch Example in Simulator
  • Press CMD + Left Arrow
  • Open Menu

What happens

screen shot 2016-05-17 at 21 10 53

#### Expected behaviour

Transition will respect current orientation of Initial Navigation Controller

Unable to install using cocoapods

screen shot 2016-04-11 at 2 21 25 pm

I am unable to install the lib, using cocoapods in terminal it shows version no. 1.1.4 ....
Although the previous version which I do have SideMenu (1.0.3) is running successfully . Please have a look into this is there any issue with the lib .

TabbarController使用出现Warning

I use sidemenu in the tabbarcontroller, when i click the tablecell in the sidemenu, the console display "warning:attempting to push a viewcontroller from a viewcontroller that doesn't have a NavigationController...."

Don't use OverFullScreen in modalPresentationStyle

The modalPresentationStyle configured with OverFullScreen cause window hierarchy when present another viewController over this.

Replace all .OverFullScreen to .OverCurrentContext to fix it.

Thanks. :-)

Passing Data

Hi jonkykong,

Do you have documentation on how to pass data between the SideMenu and the MainView?

Crash on multiple left side controller menu

SideMenuManager.menuLeftNavigationController = Table 1 .. Dashboard 1

SideMenuManager.menuLeftNavigationController = Table 2 .. Dashboard 2

Crash..

I have used following to avoid above error!

INSTEAD OF using this -
presentViewController(SideMenuManager.menuLeftNavigationController!, animated: true, completion: nil)
I have used this -
performSegueWithIdentifier("segue_menu_controller", sender: self)

发现在iOS8中的bug

在iOS8中,menuAddScreenEdgePanGesturesToPresent 设置左边手势,没效果,如果用menuAddPanGestureToPresent,则滑到右边缘再离开屏幕(或关闭的时候左滑到左边缘),会闪一下屏,具体表现为:快速关掉测滑页,然后马上再打开测滑页。

Swift 3 (Xcode Beta 5) support

@jonkykong thanks for creating a very nice/handy class. I have tried it and works just fine, but is not working properly for Swift 3 projects.
I did a quick test using the suggested migration (via Xcode) and managed to get it running, but got some bugs (not displaying the menu as it suppose to) and other issues.

The key part is, are you working on the Swift 3 version? Or should I fix it myself and do a Pull Request?

Present View Controller from side menu

What is the appropriate way to present a view controller from the menu when a row is selected (using TableViewController? Right now I am pushing modally (cover up presentation) based on the selected row, but I'd prefer it to just change whatever controller that was pushed to the side when the menu is displayed and then hide the menu when the row is selected.

Does that make sense?

black screen when open sidemenu

When i click UIBarButton side menu appears black. I did not changed any default settings. Where am i wrong? Can you help me with that issue? I am new with swift. Thank you in advance!

Informs when Side Menu start presenting menu and end presenting menu

Hi, do you think it is possible to add in a delegate, to inform the view controllers about when it will start presenting the side menu, and also when the side menu has been completely presented? Same goes to when closing the side menu. It would be help if that's added. Many thanks.

Error! Please, help

In my project there is following hierarchy:

vc - viewController
nc - navigationController
sm - sideMenu

nc1 - vc1 - ncSM - vcSM - nc2 - vc2

when call "presentViewController(SideMenuManager.menuLeftNavigationController!, animated: true, completion: nil)" from vc2, there is following error:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present modally an active controller <____: 0x7fa0148a7400>

how can I solve the problem?

Populate Sidemenu Programatically

@jonkykong first of all, thanks so much for this great library!

I was just wondering how to populate the side menu table view controller from a swift array. Where should the datasouce/ delegate be placed so that the different options can appear in the side menu?

Thanks!

Sample without Storyboard

Hey, great work with this menu!
I have a project without storyboard, so I cant use segues. I did manage to make it work using pushViewController but the first time I click the cell on the menu the push fails, on the second time and afters it works just fine.
Maybe I set something wrong and after the first click your code fix it. Can you Make a sample without a storyboard?

Thanks

Set content of the menu programmatically

        let menuLeftNavigationController = UISideMenuNavigationController(rootViewController: SideMenuViewController())
        menuLeftNavigationController.leftSide = true
        // UISideMenuNavigationController is a subclass of UINavigationController, so do any additional configuration of it here like setting its viewControllers.
        SideMenuManager.menuLeftNavigationController = menuLeftNavigationController

The code above let me open the side menu, but its empty. It should have root controller = SideMenuViewController(). It never loaded.

I tested SideMenuViewController and it display just fine anywhere else.

menuWidth

Hi,

simple and really cool menu you did here. I have just one question. Is it correct that you can't have different menuWidth for left and right controller?

Best,
Lars

hide navigation bar in sidemenu table

Hi,
Your side menu is great. But when I create a tableview to implement side menu, it has a navigation bar on top. How could I remove it for my sidemenu looks better ?

Problems with iPad and iPhone 4s

Hello,
Congratulations on your work, works fine for iPhone 5+, but fot iPad and iPhone 4s when I am using at landscape the menu doesn't get the right size, neither the main view controller.
If you can help me solve this, or give tips where I can correct it myself I will be very happy.

Kind Regards

Pod Spec Missing

I'm trying to install via Cocoapods and keep getting this: "Unable to find a specification for SideMenu (~> 1.1)" after running pod install. I have no issues installing other cocoa pod frameworks, not sure why it can't find it! I've tried running both: pod 'SideMenu' and pod 'SideMenu', '~> 1.1'

Crash if touch during swipe

Hello,

I fell into a crash/bug in the example demo.
When you swipe on the left edge, if you are in middle of swiping (= do not release your finger) then clicking (once or repeatedly) on a cell in the table ("Push View Controller 1"), the app simply freezes after releasing any touch.

More clearly :

  1. Swipe left with your right finger and do not release it
  2. Touch "Push View Controller 1" cell with your left finger
  3. Release your right finger

The app is frozen !

Can you investigate this problem ?

Thank you !

Compatibility with XCode 8

I love SideMenu but when I included it in XCode 8 (announced in WWDC2016) using Cocoapods (use_frameworks), it reported an error, saying that the framework was compiled with an earlier version of compiler. Can you provide one compiled with XCode 8?

BackgroundImage Fit

SideMenuManager.menuAnimationBackgroundColor = UIColor(patternImage: UIImage(named: "stars")!)

how to make it fit on the screen?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.