Coder Social home page Coder Social logo

myandroid007 / expandingmenu Goto Github PK

View Code? Open in Web Editor NEW

This project forked from monoqlo/expandingmenu

0.0 2.0 0.0 760 KB

ExpandingMenu is menu button for iOS written in Swift.

License: MIT License

Swift 66.74% Ruby 3.11% Objective-C 1.62% Shell 28.54%

expandingmenu's Introduction

ExpandingMenu

CI Status Version License Platform

demo

ExpandingMenu is written in Swift.

Requirements

  • iOS 8.0+
  • Xcode 7.0+

Installation

CocoaPods

You can install CocoaPods with the following command:

$ gem install cocoapods

To integrate ExpandingMenu into your Xcode project using CocoaPods, specify it in your Podfile:

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

pod 'ExpandingMenu', '~> 0.1'

Then, run the following command:

$ pod install

Carthage

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate ExpandingMenu into your Xcode project using Carthage, specify it in your Cartfile:

github "monoqlo/ExpandingMenu" ~> 0.1

Run carthage update to build the framework and drag the built ExpandingMenu.framework into your Xcode project.

Usage

import ExpandingMenu

let menuButtonSize: CGSize = CGSize(width: 64.0, height: 64.0)
let menuButton = ExpandingMenuButton(frame: CGRect(origin: CGPointZero, size: menuButtonSize), centerImage: UIImage(named: "chooser-button-tab")!, centerHighlightedImage: UIImage(named: "chooser-button-tab-highlighted")!)
menuButton.center = CGPointMake(self.view.bounds.width - 32.0, self.view.bounds.height - 72.0)
view.addSubview(menuButton)

let item1 = ExpandingMenuItem(size: menuButtonSize, title: "Music", image: UIImage(named: "chooser-moment-icon-music")!, highlightedImage: UIImage(named: "chooser-moment-icon-music-highlighted")!, backgroundImage: UIImage(named: "chooser-moment-button"), backgroundHighlightedImage: UIImage(named: "chooser-moment-button-highlighted")) { () -> Void in
            // Do some action
        }

・・・

let item5 = ExpandingMenuItem(size: menuButtonSize, title: "Sleep", image: UIImage(named: "chooser-moment-icon-sleep")!, highlightedImage: UIImage(named: "chooser-moment-icon-sleep-highlighted")!, backgroundImage: UIImage(named: "chooser-moment-button"), backgroundHighlightedImage: UIImage(named: "chooser-moment-button-highlighted")) { () -> Void in
            // Do some action
        }
        
menuButton.addMenuItems([item1, item2, item3, item4, item5])

Customize

ExpandingMenuButton

// Bottom dim view
menuButton.bottomViewColor = UIColor.redColor()
menuButton.bottomViewAlpha = 0.2

// Whether the tapped action fires when title are tapped
menuButton.titleTappedActionEnabled = false

// Menu item direction
menuButton.expandingDirection = .Bottom
menuButton.menuTitleDirection = .Right

// The action when the menu appears/disappears
menuButton.willPresentMenuItems = { (menu) -> Void in
    print("MenuItems will present.")
}

menuButton.didPresentMenuItems = { (menu) -> Void in
    print("MenuItems will present.")
}
        
menuButton.willDismissMenuItems = { (menu) -> Void in
    print("MenuItems dismissed.")
}

menuButton.didDismissMenuItems = { (menu) -> Void in
    print("MenuItems will present.")
}

// Expanding Animation
menuButton.enabledExpandingAnimations = [] // No animation

menuButton.enabledExpandingAnimations = AnimationOptions.All.exclusiveOr(.MenuItemRotation)

// Folding Animation
menuButton.enabledFoldingAnimations = .All

menuButton.enabledFoldingAnimations = [.MenuItemMoving, .MenuItemFade, .MenuButtonRotation]

ExpandingMenuItem

// Title
item.title = "text"
item.titleColor = UIColor.redColor()

Author

monoqlo, [email protected]

License

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

expandingmenu's People

Contributors

monoqlo avatar

Watchers

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