Giter VIP home page Giter VIP logo

droppymenucontroller's Introduction

DroppyMenuViewController

A swift dropping menu controller.

Auto generates the menu view by its view controllers.

Drops down from top of the screen with UIDynamics animation.

Can be used with either storyboards or manual.

Demo

alt tag

Installing

Manual

Copy & paste DroppyMenuViewController subfolder to your project.

Cocoapods

Its not ready yet.

	pod 'DroppyMenuViewController', '~> 0.1'

Usage

Storyboard

Create your view controllers in your storyboard and make sure give them a Storyboard Identifier and Title (for the menu item). Create a subclass of DroppyMenuViewController and in its viewDidLoad: method, setup self.viewControllers property

	class MenuViewController: DroppyMenuViewController {

	    override func viewDidLoad() {
	        super.viewDidLoad()

	        let first = getViewController("First")
	        let second = getViewController("Second")
	        let third = getViewController("Third")
	        
	        viewControllers = [first, second, third]
	    }
	    
	    func getViewController (storyboardIdentifier: String) -> UIViewController {
	        return UIStoryboard (name: "Main", bundle: nil).instantiateViewControllerWithIdentifier(storyboardIdentifier) as! UIViewController
	    }
	}

Manual

In your AppDelegate's application:didFinishLaunchingWithOptions: method, create your view controllers.
Then create a DroppyMenuViewController with that view controllers.
Initilize window property and set rootViewController as your menu controller.

    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        
        let first = FirstViewController ()
        let second = SecondViewController ()
        let third = ThirdViewController ()
        
        let menuController = DroppyMenuViewController (viewControllers: [first, second, third])
        
        window = UIWindow (frame: UIScreen.mainScreen().bounds)
        window!.rootViewController = menuController
        window!.makeKeyAndVisible()
        
        return true
    }

DroppyMenuViewAppeareance

	struct DroppyMenuViewAppeareance {
	    
	    var tintColor: UIColor
	    var font: UIFont
	    var backgroundColor: UIColor
	    
	    var lineWidth: CGFloat
	    
	    var gravityMagnitude: CGFloat
	    var springVelocity: CGFloat
	    var springDamping: CGFloat
	}

The default appeareance is

	extension DroppyMenuViewAppeareance {
	    
	    init () {
	        self.tintColor = UIColor.whiteColor()
	        self.font = UIFont (name: "HelveticaNeue-Light", size: 20)!
	        self.backgroundColor = UIColor (white: 0, alpha: 0.5)
	        self.gravityMagnitude = 10
	        self.springDamping = 0.9
	        self.springVelocity = 0.9
	        self.lineWidth = 1
	    }
	}

You can change appeareance after creating the menu controller.

        var appear = DroppyMenuViewAppeareance ()
        appear.font = UIFont (name: "HelveticaNeue-Light", size: 20)!
        appear.tintColor = UIColor.whiteColor()
        appear.backgroundColor = UIColor (white: 0, alpha: 0.5)
        appear.lineWidth = 1
        menuController.menuView.appeareance = appear

droppymenucontroller's People

Contributors

cemolcay avatar

Stargazers

Huang avatar Mesut Cilingir avatar chanju Jeon avatar  avatar Umit Kitapcigil avatar

Watchers

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