Git Product home page Git Product logo

slidemenucontrollerswift's Introduction

SlideMenuControllerSwift

Platform Language License Issues Downloads

iOS Slide View based on iQON, Feedly, Google+, Ameba iPhone app.

sample

Installation

CocoaPods

pod 'SlideMenuControllerSwift'

Carthage

if iOS8 or later, Carthage is supported

  • Add github "dekatotoro/SlideMenuControllerSwift" to your Cartfile.
  • Run carthage update.

for more info, see Carthage

Manually

Add the SlideMenuController.swift file to your project.

Usage

Setup

Add import SlideMenuControllerSwift in your file

In your app delegate:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {

    // create viewController code...
        
    let slideMenuController = SlideMenuController(mainViewController: mainViewController, leftMenuViewController: leftViewController, rightMenuViewController: rightViewController)
    self.window?.rootViewController = slideMenuController
    self.window?.makeKeyAndVisible()    

    return true
}

Storyboard Support

  1. Inherit SlideMenuController and put UIViewController in a storyboard.
  2. Override awakeFromNib, then instantiate any view controllers
class ContainerViewController: SlideMenuController {

    override func awakeFromNib() {
        if let controller = self.storyboard?.instantiateViewControllerWithIdentifier("Main") {
            self.mainViewController = controller
        }
        if let controller = self.storyboard?.instantiateViewControllerWithIdentifier("Left") {
            self.leftViewController = controller
        }
        super.awakeFromNib()
    }

}

If you want to use the custom option, please set them before calling the init method, like so:

SlideMenuOptions.leftViewWidth = 50
SlideMenuOptions.contentViewScale = .50
...
    

You can access from UIViewController

self.slideMenuController()?

or

if let slideMenuController = self.slideMenuController() {
    // some code
}

add navigationBarButton

viewController.addLeftBarButtonWithImage(UIImage(named: "hoge")!)
viewController.addRightBarButtonWithImage(UIImage(named: "fuga")!)

open and close

// Open
self.slideMenuController()?.openLeft()
self.slideMenuController()?.openRight()

// close
self.slideMenuController()?.closeLeft()
self.slideMenuController()?.closeRight()

monitor the states of menu, you can use SlideMenuControllerDelegate use this:

func leftWillOpen()
func leftDidOpen()
func leftWillClose()
func leftDidClose()
func rightWillOpen()
func rightDidOpen()
func rightWillClose()
func rightDidClose()

Requirements

Requires Swift3.0 and iOS 8.0 and ARC.
If you are developing in the Swift1.1 ~ 2.3, please use branch of swift1.1 ~ 2.3.
If you want to use even iOS8.0, please to import the code directly.
If you want to use objective-c even iOS6.0, plesea use SlideMenuControllerOC.

Features

  • Highly customizable
  • Complete example

Contributing

Forks, patches and other feedback are welcome.

Creator

SlideMenuControllerSwift

Yuji Hato Blog

SlideMenuControllerOC

Pluto Y Blog Sing Weibo

License

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

slidemenucontrollerswift's People

Contributors

dekatotoro avatar pluto-y avatar alexanderkhitev avatar zirinisp avatar pmusolino avatar sydneyitguy avatar matsuda avatar cowgp avatar ppeelen avatar loginoleg avatar hassan-rafique avatar gbitaudeau avatar s0meone avatar ridwy avatar andresilvagomez avatar jankonas avatar maikohermans avatar eeearl avatar serejahh avatar chipp avatar f2m2rd avatar joergbirkhold avatar sunsidew avatar

Watchers

James Cloos avatar Manish Rathi avatar

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.