GithubHelp home page GithubHelp logo

aperechnev / sidebaroverlay Goto Github PK

View Code? Open in Web Editor NEW
67.0 5.0 28.0 1.46 MB

Yet another implementation of sidebar menu, but here your menu appears over the top view controller.

License: MIT License

Ruby 3.14% Swift 94.65% Objective-C 2.21%
sidebar-menu ios swift cocoapods swift-library ui-components ui-control menu navigation

sidebaroverlay's Introduction

SidebarOverlay

codebeat badge Join the chat at https://gitter.im/aperechnev/SidebarOverlay Travis CI CocoaPods CocoaPods CocoaDocs codecov.io

SidebarOverlay is an implementation of sidebar menu, similar to ECSlidingViewController. The difference is that in SidebarOverlay the sidebar menu covers the top view when user opens it, like on the picture below:

SidebarOverlay application example

Installation

The easiest way to start development using SidebarOverlay is to install it via CocoaPods. Just add it to your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'

pod 'SidebarOverlay'

Getting Started

It's quit simple to start developing with SidebarOverlay. First, we have to create three view controllers on our storyboard:

  • container view controller
  • top view controller
  • side view controller

The container view controller is the root view controller that makes all magic for us. It's necessary to subclass SOContainerViewController and assign it to our container view controller. Then we can setup top and side view controllers:

import SidebarOverlay

class ContainerViewController: SOContainerViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
    
        self.menuSide = .Right
        self.topViewController = self.storyboard?.instantiateViewControllerWithIdentifier("topScreen")
        self.sideViewController = self.storyboard?.instantiateViewControllerWithIdentifier("leftScreen")
    }

}

Set the container view controller as initial on your storyboard and your basic application with sidebar is ready to run.

Open sidebar menu programatically

It's always good if user is able to open sidebar menu not only by swipe gesture, but also by tap on menu button. To open sidebar menu programatically, set isSideViewControllerPresented property of container view controller to true:

class TopViewController: UIViewController {
    
    @IBAction func showMeMyMenu () {
        if let container = self.so_containerViewController {
            container.isSideViewControllerPresented = true
        }
    }

}

As you see, we have property named so_containerViewController. This property is automatically added to all view controllers and you're able to access it everywhere.

To close the sidebar menu, just set the isSideViewControllerPresented property to false.

Changing top view controller from the sidebar menu

Since you've implemented your sidebar menu on the left view controller, you need to show different top view controllers each time user chooses an item in menu. It's pretty simple. Just set the topViewController property of container view controller:

// Table view delegate method that invokes when user chooses an item in UITableView
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
    let profileViewController = self.storyboard!.instantiateViewControllerWithIdentifier("profileViewController")
    self.so_containerViewController.topViewController = profileViewController
}

How To Contribute

Please follow the git-flow notation and make sure that all tests are passing before contributing. Your questions and pull requests are welcome.

Code coverage

codecov.io

Versioning

We are using semantic versioning.

Support

If you need some help, you can join our gitter room.

License

SidebarOverlay is released under the MIT license. See LICENSE for details.

sidebaroverlay's People

Contributors

abakhtin avatar aperechnev avatar gitter-badger avatar milosuzice avatar mozharovsky 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

Watchers

 avatar  avatar  avatar  avatar  avatar

sidebaroverlay's Issues

Swift Packages

The package dependency graph can not be resolved; unable find any available tag for the following requirements:

Swipe gesture to open menu not working in Arabic

If you configure your device to be in Right-to-Left languages such as Arabic, the menu properly opens up on the right side of the screen but the gesture to open it no longer works. Using the same compiled code switching back to left-to-right languages the same menu opens up using swipe gestures.

Option to disable the pan gesture

Adding this option will leave it optional to developer to call it via programming or via touch, depending on his view state, this will be awesome, thanks a lot for the pod!

Button Back not appear in swift

Hello I tried use code

let recentlyAddedViewController = RecentlyAddedViewController()
navigationController?.pushViewController(recentlyAddedViewController, animated: true)

but it seems like button back not appear
did you have any example how to use it ?

thanks

Change the title

How do I control each UILabel to have different titles in each cell, and is it possible to hide the menu after the selecting a cell?

Hide menu gesture not working

I updated to 4.2.1 and the swipe gesture to remove the side menu is not responding. I did a little debugging and it seems the gesture callback is being called in the wrong direction (to show it more)

viewWillAppear called only once

Hi , I am trying to run some functions in viewWillAppear, but unfortunately SidebarOverlay calls viewWillAppear only once. how should run my func whenever SidebarOverlay opens ?

Unresponsive TableView

Hello Alexander,

When setting an UITableViewController as the topViewController, the tableView's scroll remains unresponsive. The cells within it are working fine. Is there any solution to that?

Thanks,
Qianen

Navigation Bar will hide automatically

I am facing issue that when i go to TopViewController it Hides the navigationbar i tried alot but no solution found, any idea this is not working properly

There may be some error for edge gesture

In SOContainerViewController

-moveMenu(_ panGesture: ) and viewDidLayoutSubviews.updateSideMenuFrame may change side view center.x at same time, so pan gesture is not working. you should disable viewDidLayoutSubviews.updateSideMenuFrame when pangesture is working

Side bar issue

When I installed the library, everything is working cool.
But in some controllers I dont want to let users open menu by swiping.
Is there any ways to do that?

Thanks.

Width of side bar

Can the side bar width customized. In case of landscape mode it covers the screen 90 percent when opened.

Without Main StoryBoard

is there any way without using main storyboard (programming )

self.topViewController = self.storyboard?.instantiateViewController(withIdentifier: "topScreen")
self.sideViewController = self.storyboard?.instantiateViewController(withIdentifier: "LeftViewController")

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.