CocoaPods trunk is moving to be read-only. Read more on the blog, there are 18 months to go.

AnimatedDropdownMenu 0.3.3

AnimatedDropdownMenu 0.3.3

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Mar 2017
SwiftSwift Version 3.0
SPMSupports SPM

Maintained by JonyFang.



  • By
  • JonyFang

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
pod install --no-repo-update
open Examples.xcworkspace

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.