Coder Social home page Coder Social logo

jonyfang / animateddropdownmenu Goto Github PK

View Code? Open in Web Editor NEW
69.0 4.0 5.0 147 KB

A clean interface dropdown menu, appears underneath navigation bar to display a list of related items when you click on the navigation title.

License: MIT License

Swift 96.46% Ruby 3.54%
swift-3 animated dropdownmenu navigation

animateddropdownmenu's Introduction

AnimatedDropdownMenu

AnimatedDropdownMenu is a clean interface dropdown menu, appears underneath navigation bar to display a list of related items when you click on the navigation title.

Type 01 Type 02 Type 03
Type 04 Type 05 Type 06
Type 07 Type 08 Type 09

Requirements

  • Xcode 8.0+
  • iOS 8.0+
  • Swift 3.0

Example

To run the example project, clone the repo, and start Examples in Xcode.

$ git clone https://github.com/JonyFang/AnimatedDropdownMenu
$ cd AnimatedDropdownMenu/Examples
$ open Examples.xcworkspace

Installation

CocoaPods

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

pod 'AnimatedDropdownMenu'

Usage

Get Started

Import the library where you want to use it.

import AnimatedDropdownMenu

class ExampleViewController: UIViewController {
    // MARK: - Properties
    fileprivate var selectedStageIndex: Int = 0
    fileprivate let dropdownItems: [AnimatedDropdownMenu.Item] = [
        AnimatedDropdownMenu.Item.init("EXPLORE", nil, nil),
        AnimatedDropdownMenu.Item.init("POPULAR", nil, nil),
        AnimatedDropdownMenu.Item.init("RECENT", nil, nil)
    ]

    // MARK: Life Cycle
    override func viewDidLoad() {
        super.viewDidLoad()
        
        let dropdownMenu = AnimatedDropdownMenu(navigationController: navigationController, containerView: view, selectedIndex: selectedStageIndex, items: dropdownItems)
        dropdownMenu.didSelectItemAtIndexHandler = {
            [weak self] selectedIndex in
            guard let strongSelf = self else {
                return
            }
            strongSelf.selectedStageIndex = selectedIndex
            //Configure Selected Action
        }

        navigationItem.titleView = dropdownMenu
    }
}

Customization

Once you have setup the dropdown menu, you can custom the interface of menu. You can override these properties for your favor:

  • menuTitleColor: The font of the navigation bar title. Default is UIFont.systemFont(ofSize: 16.0)
  • menuArrowTintColor: The tint color of the arrow. Default is .darkGray
  • cellBackgroundColor: The color of the cell background. Default is RGBA(216, 85, 96, 1)
  • cellSelectedColor: The color of the cell when the cell is selected. Default is .clear
  • cellSeparatorColor: The color of the cell separator. Default is RGBA(255, 255, 255, 0.3)
  • cellTextColor: The color of the text inside cell. Default is RGBA(255, 255, 255, 0.3)
  • cellTextSelectedColor: The color of the text inside cell when the cell is selected. Default is .white
  • cellTextAlignment: The alignment of the text inside cell. Default is .center

Author

Contributing

Please open a new Issue here if you run into a problem specific to AnimatedDropdownMenu, have a feature request, or want to share a comment.

License

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

animateddropdownmenu's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

animateddropdownmenu's Issues

The issue of dependence

Cannot execute the command line order -pod install --no-repo-update....
Which one you choose to manage the dependence.I know it's a framework from your first App....Great.Come on

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.