GithubHelp home page GithubHelp logo

helongcn / slidemenucontrollerswift Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dekatotoro/slidemenucontrollerswift

0.0 1.0 0.0 2.77 MB

iOS Slide Menu View based on Google+, iQON, Feedly, Ameba iOS app. It is written in pure swift.

License: MIT License

Ruby 0.95% Swift 98.18% Objective-C 0.87%

slidemenucontrollerswift's Introduction

SlideMenuControllerSwift

Platform Language License Issues

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()

Requirements

Requires Swift2.0 and iOS 8.0 and ARC.
If you are developing in the swift1.1, please use branch of swift1.1.
If you are developing in the swift1.2, please use branch of swift1.2.
If you want to use even iOS7.0, please to import the code directly.

Features

  • Highly customizable
  • Complete example

Contributing

Forks, patches and other feedback are welcome.

Creator

Yuji Hato Blog

License

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

slidemenucontrollerswift's People

Contributors

dekatotoro avatar matsuda avatar ridwy avatar hassan-rafique avatar loginoleg avatar ppeelen avatar s0meone avatar jankonas avatar f2m2rd avatar joergbirkhold avatar sunsidew avatar

Watchers

James Cloos 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.