Giter Club home page Giter Club logo

kydrawercontroller's Introduction

KYDrawerController

Carthage compatible Pod Version Pod Platform Pod License Language Swift version

KYDrawerController is a side drawer navigation container view controller similar to Android.

  • Storyboard Support
  • AutoLayout Support

image.png storyboard.pngdrawer.gif

Installation

CocoaPods

KYDrawerController is available on CocoaPods. Add the following to your Podfile:

pod 'KYDrawerController'

Manually

Just add the Classes folder to your project.

Usage

(see sample Xcode project in /Example)

Code

import UIKit
import KYDrawerController

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        // Override point for customization after application launch.
        
        let mainViewController   = MainViewController()
        let drawerViewController = DrawerViewController()
        let drawerController     = KYDrawerController()
        drawerController.mainViewController = UINavigationController(
            rootViewController: mainViewController
        )
        drawerController.drawerViewController = drawerViewController
        
        /* Customize
        drawerController.drawerDirection = .Right
        drawerController.drawerWidth     = 200
        */
       
        window = UIWindow(frame: UIScreen.mainScreen().bounds)
        window?.rootViewController = drawerController
        window?.makeKeyAndVisible()
        
        return true
    }

Storyboard

  1. Set the KYDrawerController to Custom Class of Initial ViewController.

usage1.png

  1. Connects the KYEmbedDrawerControllerSegue to DrawerViewController from KYDrawerController

usage2.png

  1. Connects the KYEmbedMainControllerSegue to DrawerViewController from KYDrawerController

usage3.png

  1. Set the SegueIdentifiers to inspector of KYDrawerController.

usage4.png

Open/Close Drawer

func setDrawerState(state: DrawerState, animated: Bool)

Delegate

optional func drawerController(drawerController: KYDrawerController, stateChanged state: KYDrawerController.DrawerState)

Objective-C version

https://github.com/AustinChou/KYDrawerController-ObjC

License

This code is distributed under the terms and conditions of the MIT license.

kydrawercontroller's People

Contributors

ykyouhei avatar ikesyo avatar waterlink avatar danielrosero avatar petropavel13 avatar

Watchers

James Cloos avatar Jonasz Baron 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.