Code Monkey home page Code Monkey logo

enswiftsidemenu's Introduction

ENSwiftSideMenu

A lightweight flyover side menu component for iOS with the UIDynamic's bouncing animation, UIGestures and UIBlurEffect. Allows you to use native UINavigationController's logic to manage view controllers. The component is written in Swift.

Requirements

  • iOS 9 or higher

Installation

CocoaPods

The recommended way for installating ENSwiftSideMenu is via the CocoaPods package manager

platform :ios, '9.0'
pod 'ENSwiftSideMenu', '~> 0.1.4'

Manual Install

All you need is import ENSideMenu.swift and ENSideMenuNavigationController.swift to your project folder.

Usage Example

  1. Create a root UINavigationController subclassing from ENSideMenuNavigationController
  2. Create a UIViewController for your side menu
  3. Initilize the menu view with a source view and menu view controller:
override func viewDidLoad() {
  super.viewDidLoad()
  sideMenu = ENSideMenu(sourceView: self.view, menuViewController: MyMenuViewController(), menuPosition:.Left)
  // show the navigation bar over the side menu view
  view.bringSubviewToFront(navigationBar)
}
  1. To change content view controller use next line in your menu view controller:
sideMenuController()?.setContentViewController(destViewController)
  1. Check example project for more explanation

License

The MIT License (MIT)

Copyright (c) 2014 Evgeny Nazarov

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

enswiftsidemenu's People

Contributors

andrewebling avatar ctipka avatar darrarski avatar devtalking avatar evnaz avatar gabrielribeiro avatar igorkulman avatar kitasuke avatar kn-neeraj avatar mharoonbaig avatar mikrobi avatar mpclarkson avatar ncerezo avatar nicholas avatar okipol88 avatar peymanmortazavi avatar pujabelwal avatar stdogbert avatar zixun avatar zmack 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

enswiftsidemenu's Issues

Menu will not reopen following unwinding from a view controller where sideMenuShouldOpenSideMenu() is false

Thank you for your answer to my question regarding sideMenuShouldOpenSideMenu() a few days ago, but I now seem to be having further issues.

ViewController1 has sideMenuShouldOpenSideMenu() set to true.
ViewController2 has sideMenuShouldOpenSideMenu() set to false.

It works fine until I unwind from ViewController2 to ViewController1. sideMenuShouldOpenSideMenu(), it seems, continues to be set to false, as the menu will no longer open in ViewController1. I am assuming that is because sideMenuShouldOpenSideMenu() is not being called upon return. Is there a way around this?

Edit: It seems that this is sporadic and only happens when I unwind a segue from within a UIAlert. I can't imagine what the issue could be.

TabBarController

When I try to use the sidemenu with the tabBarController, the transition only occurs when I press a button (in my case, the backButton I created in the navigationBar) after i press the respective row in the tableView.

After the transition, the sideMenu don't dismiss and I need to press the menuButton or use the gestureRecognizer to dismiss him.

Is this a hierarchy problem? I'm trying to figure out but I don't know where to look.

Ability to keep same navigation bar (with Bar Button Item) on different ViewControllers?

Hello.

Thanks for making this library. It has been very helpful and looks/functions great!

I was just wondering if there was a way to keep the same Navigation Bar to appear on all View Controllers that are selectable from the SideMenu?

Basically, on your example, is there a way to keep the Navigation Bar of the View Controller #1 that has the Toggle button on the left so that View Controllers #2, 3, & 4 have that same Nav Bar?

I tried to add a Navigation Bar to a View Controller that isn't the Root View Controller of the Menu Navigation Controller, but it just added another Navigation Bar below the existing one.

Thanks,
Deric

Load next view

Hi great work with your sample to sideMenu, i have a problem but i need move to next viewController but not find to func for to call next view for to work to current flow control

Side menu overlaps navigation bar

Both when implemented in my project and the downloaded example, the side menu overlaps the navigation bar. I'm running Xcode 6.2 beta.

Problem using enswiftsidemenu

Hello,

Thank you for this great content. As this is my first project on Swift, I have a little problem that I can't fix when using ENSwiftSideMenu.

The content of the side menu appears on the page, but the links to other pages do not work. However I have noticed that if I set the page Menu Navigation Controller (with the class ENSideMenuNavigationController) as the "initial view controller", the links work.

Actually, I am looking to do this:
when a user has logged in, I use the instantiateViewControllerWithIdentifier method to move to the ENSideMenuNavigationController object, so that it can be used in the "Accueil" page. As I configured it, it does not work.

Please find below my storyboard:
capture d ecran 2014-11-02 a 5 53 31 pm

Hope I have made myself clear enough.
Thx

Show at startup?

Is there a way to show the Menu on launching the app __ not having to wait for the first swipe.

I poked around but could not find that piece of code to change.

PS, Great piece of work here!, would be super helpful (and a great teaching tool) to have an "infographic" explaining how it all works (interconnects). How all the pieces talk to each other (I'm still a Swift beginner). There is lots of code, just trying to get my brain wrapped around it.

thanks, ed

Xcode Version 6.0.1 (6A317) operand of "!" problem

Hi, clone this project and build with Xcode Version 6.0.1 (6A317), it occur the problems in ENSideMenu.swift as below
operand of "!" should have option type;type is "UIDynamictemBehavior" "UIGravityBehavior" "UIWindow"

Menu bouncing

Excuse me, i'm not new to obj-c, but new to swift, so can't understand how to disable side menu bouncing? It's really annoying. Looks like you make menu to act like a real physical body, but when i try to play with it density, elasticity and so on, but nothing happens or it just throw menu out of screen bounds) Please help me!

a new viewcontroller instance is made

first of all, great work!!!

I am looking for a way for the menu to pop a previously visited view controller at it's latest state, not to instantiate a new one... any tips?

Multiple UIViewController Preparation

Hi,

This is awesome, it's easy to use, but what if I have multiple UIViewControllers? How can I create one SideMenu for all multiple controller without the need of invoking the menu on each view controller.

It would be great if the ENSwiftSideMenu came with a Storyboard too.

Back Button in the Navigation Bar

I'm having trouble including a Back Button in the Navigation Bar. I've tried changing this to false:
self.navigationItem.hidesBackButton = false
But it didn't work. Any suggestions?

Turning off the menu in some view controllers

I'm having unexpected results with the menu, though perhaps this has to do with me being new to coding than anything else. I expected to only have the menu appear in certain view controllers - those I made delegates of the menu. This would just be those view controllers actually listed in the menu, and not subsequent view controllers segued to. However, this does not seem to be the case as the menu is always accessible when swiping from the left edge of the screen.

Is there any way to turn off the menu in certain view controllers?

Design of menu UITVC in storyboard?

The example shows a UITableViewController being created in cade and passed to the ENSideMenu. I've tried to design this in storyboard with a custom cell class.
The table loads fine on it's own (make it first view controller as test) but when the SideMenuNavigationController is first VC, the app crashes with: "unable to dequeue a cell with identifier Cell....."

Am I missing something trivial or is a code-generated table the only way to use this?

Cocoapods

Will be available in Cocoapods? :-)

Gesture supports

Is this only supports left gesture???...means when i open side menu from left side using gesture....why i am not able to close it with right to left gesture

Storyboard Support

I want to use Side Menu in my project. Is there any storyboard support?

Showing progressHUD when selecting items from SideMenu

I got an app that takes about 2-3 seconds to load the new screen when an item from the sidemenu is clicked and I am using a progressBar library to try and display the loading process.

Problem is I do not know which methods am I supposed to show and hide the progress bar. I tried doing it in the same method as presenting the viewcontroller but unfortunately, it only shows the progressbar at the end of the presentation of the viewcontroller instead of immediately.

custom UITableView Cell for side menu

I'm trying to implement a TableViewController with a custom cell like below.

class menuItem: UITableViewCell {
    @IBOutlet var menuLabel: UILabel!
    @IBOutlet var menuImage: UIImageView!
}

When I use this as a table view (connecting the outlets to the story board prototype cells with UILabel, UIImageView) it works well. But when I'm injecting it into the Navigation controller it fails to create a custom UITableView Cell.

  func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> menuItem {
    let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as! menuItem
    if cell == nil {
        cell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: "cell") as! menuItem
    }
    return cell  
  }

// cell value is always nil. Even after Manually creating in cell == nil condition

Can any one help me with this ?

Error while building ObjcExample

/Users/Me/Downloads/ENSwiftSideMenu-master/ObjCExample/ObjCExample/AppDelegate.m:30:85: No visible @interface for 'ENSideMenuNavigationController' declares the selector 'initWithMenuTableViewController:contentViewController:'

Explaining the first line?

self.sideMenuController()?.sideMenu?.delegate = self;

That's a pretty complex statement. How can these be optionals? They have to be required, could you maybe explain (and break apart this line) in English? Or a visual, thanks

Disable Menu?

Is there a simple way to disable the menu on a particular view controller? Sorry if it sounds n00bish but I am 😊

Slider menu animation behaviour need to change little

Hi,

This is a nice example for slider menu.

I need some change in animation behaviour. it should be like parentview will be slide when sliderview open instead of overlapping sliderview on parentview.

I need the same behaviour of slidermenu just like facebook app have .

Any help will be more appreciate.

Thanks.

swift 1.2

Hello,

i have tried today to run my project on the new xcode 6.3 beta with swift 1.2, but i have seen that your project isn´t compatible with this swift version. My question is when you want to adapt your project to swift 1.2.

iOS 7 Compatibility

Is this fonctionnality compatible to iOS 7 ?

If not, any idea to do it ?

Thank you very much !

more easy to use

hi,In MyMenuTableViewController, I use this

    var menuArray = ["welcome", "multiMedia", "imageFilters", "ViewController4"]
    ....
    destViewController =    mainStoryboard.instantiateViewControllerWithIdentifier(menuArray[indexPath.row]) as     UIViewController
    ...
    cell!.textLabel.text = menuArray[indexPath.row] 

instand of

    switch (indexPath.row) {
    case
    case
    ...
    default
    }
    ....
    cell!.textLabel.text = "ViewController #\(indexPath.row+1)"

it is more easy to use

Incorrect behavior when screen rotates

When the screen rotates the menu does not update it's position, that leads to it to be visible if hidden and in the wrong place. It also makes it disappear if you try to hide/show it.
I'm making a pull request to fix it.

Can I use with Obj-C?

Im trying to use with my objc project but have a problem with calling

sideMenu = ENSideMenu(sourceView: self.view, menuTableViewController: MyMenuTableViewController(), menuPosition:.Left)

Any suggestion?

Very cool sidemenu.
Thank you very very much.

Have menu push content

Is there an easy way to use this and have it push all the content over instead of having the menu go under the navigation bar and just over the content?

Problem trying to replicate StoryBoard Example.

I'm trying to replicate your storyboard example, but I can't seem to get it to work. I don't understand how you are linking up the storyboards Navigation Controller with your "My Navigation Controller" class.

I initially had an application with one ViewController in my storyboard. I then add the UINavigationController to the storyboard and set the ViewController as the rootViewController. Then, I add a Menu button and map it to the toggleMenuButton IBAction where I call the toggleSideMenu() function.

I know I'm doing something wrong though because that custom NavigationController never gets instantiated and I'm not sure how to do that through the storyboard.

Any advice at all is greatly appreciated.

height of menu if orientation is changed

Great work, I really enjoy the menu!
However I have a small problem if the menu is open and the orientation is changed from portrait to landscape. The menu position works fine, but the scrolling of the menu is not enabled if there are a lot of entries. To reproduce this just create a menu with 10 or more entries, so that not all are directly visible in landscape mode.
I tried to change the height of the sidemenu tableview, but couldn't quite get a working soltion since I am pretty new to mobile programming.
Hope someone has a suggestion to solve this problem.
Keep up the good work

Cannot assign to 'menuPosition' in 'self'

As per subject, I got this error message on this line inside ENSideMenu.swift

public init(sourceView: UIView, menuPosition: ENSideMenuPosition) {
        super.init()
        self.sourceView = sourceView
        self.menuPosition = menuPosition
        self.setupMenuView()

Please advice. Thank you.

Checking the state of the menu, opened/closed

Is there a way to check if the sidemenu is opened?
I was looking at the source and saw this

    private var isMenuOpen : Bool = false

I was wondering whether you expose an API for other developers using the library to detect if the menu is opened in the app/

Swipe from right with Objective C

Hi All,

  1. How to set up to allow side menu swipe from right side?
  2. I have swipe and pan gesture in my primary view (source view), how to disable swipe gesture for ENSwiftSideMenu in and out?

Thanks in advance.

Problem with Side Navigation when switching View without using Nav Items from SideMenu

Hi,

at first I want to thank you for your great work. It saved me a lot of time :) ..

I've got following setup:

  • A "source" View Controller embedded in the NavigationController, 2 MenuItems --> 2 View Controllers
  • A Button, OnTouch: Shows a third independent View Controller (not related to the Menu Items / Navigation Controller)
  • On the third View I've put on a button redirecting to the "source" View Controller

I've got following issue: Whenever I am returning to the "source" view form the independent (3.) View Controller, the side menu items don't work anymore. The side bar still works well but whenever I click on a menu item it won't show up the corresponding View.

The return Segue (from the 3. View Controller to the "source" View Controller) is connected to the Navigation Controller.

What am I missing?

Thank you very much

Use segue to get to next view in the navigation stack

First thanks for the great component.

Is their a possibility to navigate to next view with a code like this:

var smc : ENSideMenuNavigationController?

...   

smc!.navigationController?.presentedViewController?.performSegueWithIdentifier("mySegueName", sender: self)

Wrong sidemenu positioning when bouncingEnabled=false

Hi there!

Sidemenu positioning itself wrong when we disables bouncingEnabled:

sideMenu?.bouncingEnabled = false

Solution: fix problem in private func toggleMenu (shouldOpen: Bool) [ENSideMenu.swift]
this

destFrame = CGRectMake((shouldOpen) ? -2.0 : menuWidth, 0, menuWidth, sideMenuContainerView.frame.size.height)

for this

destFrame = CGRectMake((shouldOpen) ? -2.0 : -menuWidth-2, 0, menuWidth, sideMenuContainerView.frame.size.height)

Is there a built-in way to programatically switch between menu items?

For example, if a user goes to a menu item, and the app determines that the user has not logged in, then it should redirect to the login tab.

The only way I know to do this is by using self.sideMenuController()?.setContentViewController, but that doesn't change the selected menu index. I'm wondering if there's some handy method around that i missed.

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.