An iOS drop down menu with pretty animation and easy to customize.

Overview

IGLDropDownMenu

An iOS drop down menu with pretty animation.

Screenshot

How To Use

Use CocoaPods:

pod 'IGLDropDownMenu'

Manual Install:

Just drap the files in folder IGLDropDownMenu to your project.

####!Try the demo. It's really helpful!

Sample Code

  1. Create your IGLDropDownItem array and set up

    NSMutableArray *dropdownItems = [[NSMutableArray alloc] init];
    IGLDropDownItem *item = [[IGLDropDownItem alloc] init];
    [item setIconImage:[UIImage imageNamed:@"icon.png"]];
    [item setText:@"title"];
    [dropdownItems addObject:item];
  2. Create your IGLDropDownMenu and set the up the parameter name dropDownItems

    IGLDropDownMenu *dropDownMenu = [[IGLDropDownMenu alloc] init];
    [dropDownMenu setFrame:CGRectMake(0, 0, 200, 45)];
    dropDownMenu.menuText = @"Choose Weather";
    dropDownMenu.menuIconImage = [UIImage imageNamed:@"chooserIcon.png"];
    dropDownMenu.paddingLeft = 15;  // padding left for the content of the button
  3. modify the params of IGLDropDownMenu

    dropDownMenu.type = IGLDropDownMenuTypeStack;
    dropDownMenu.gutterY = 5;
    dropDownMenu.itemAnimationDelay = 0.1;
    dropDownMenu.rotate = IGLDropDownMenuRotateRandom;
  4. Call the reloadView method (Very Important!)

    // every time you change the params you should call reloadView method
    [dropDownMenu reloadView];

Parameters

These are just some of the parameters you can use, you can find more(or make more) in the code.

####For IGLDropDownMenu

  • animationDuration set the duration(s) of the animation in second

  • animationOption set the UIViewAnimationOptions for the animation

  • itemAnimationDelay set the delay(s) before each of item start to animate

  • direction set the direction when the menu expand

  • IGLDropDownMenuDirectionDown default value, expand downward
  • IGLDropDownMenuDirectionUp expand upward
  • rotate set the rotate style when the menu on expand
  • IGLDropDownMenuRotateNone default value, for no rotate
  • IGLDropDownMenuRotateLeft rotate to left on expand
  • IGLDropDownMenuRotateRight rotate to right on expand
  • IGLDropDownMenuRotateRandom rotate random on expand every single time
  • type set the menu type (remember when you set the type to SlidingIn* you can't have the rotate type at the same time.)
  • IGLDropDownMenuTypeNormal default value, item will hide behind the menu button on fold
  • IGLDropDownMenuTypeStack item will hide behind the menu button and make a stack like look
  • IGLDropDownMenuTypeSlidingInBoth item will slide in and out from both sides
  • IGLDropDownMenuTypeSlidingInFromLeft item will slide in from left
  • IGLDropDownMenuTypeSlidingInFromRight item will slide in from right
  • IGLDropDownMenuTypeFlipVertical item will flip vertical
  • IGLDropDownMenuTypeFlipFromLeft item will flip from left
  • IGLDropDownMenuTypeFlipFromRight item will flip from right
  • slidingInOffset set the offset value for the items slide in and out
  • gutterY set the Y gutter between items
  • alphaOnFold set the item alpha value when menu on fold, only use this when the style won't fit your mind
  • flipWhenToggleView when you set this to true, the menu button will flip up when you click
  • useSpringAnimation use the spring animation for iOS7 or higher version, default is true
  • menuButtonStatic keeps the menu button static regardless of selected menu item, default is NO

####For IGLDropDownItem

  • iconImage set the icon image for the item
  • text set the text string for the item
  • textLabel for you to adjust the text label style
  • object you can store your custom item in this property
  • index the item index
  • paddingLeft the left padding of the image view or only text
  • showBackgroundShadow you can hide the drop down shadow with this property
  • backgroundColor you can change the background color with this property

Remember the menuButton in IGLDropDownMenu is also an IGLDropDownItem.

CustomView

If you want to control the view by yourself, you can use the initWithMenuButtonCustomView of IGLDropDownMenu and initWithCustomView of IGLDropDownItem. If you use customView, the customView will auto set userInteractionEnabled = NO and the menu menuButtonStatic = YES and some style parameters will be invalid. You need to handle it yourself. I make a customView in the demo, try it!

Delegate

####For IGLDropDownMenu

  • - (void)dropDownMenu:(IGLDropDownMenu*)dropDownMenu selectedItemAtIndex:(NSInteger)index;
  • - (void)dropDownMenu:(IGLDropDownMenu *)dropDownMenu expandingChanged:(BOOL)isExpanding;

Requirements

  • target platform: >=iOS 6.0 (I never test the version below 6.0, maybe you can make some try and tell me.)
  • ARC

Thanks

This drop-down menu idea is come from here, I found this demo one day and just implement it on iOS.

License

The MIT License (MIT)

Copyright (c) 2014 Galvin Li

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Comments
  • Is there a way or delegate method to detect if the menu is tapped/open?

    Is there a way or delegate method to detect if the menu is tapped/open?

    I have multiple drop down menus as well as some text fields. I would like to close the open menu if a textField becomes first responder, or another menu is tapped. Is there a delegate method to do that?

    opened by Jackson0111 9
  • Changing DropDownItem textLabel stuff not doing anything

    Changing DropDownItem textLabel stuff not doing anything

    Is there a reloadView() but for DropDownItem modifications?

    I have the following:

    let font = UIFont.init(name: "Avenir Next Medium", size: 15.0)
    var items = [IGLDropDownItem]()
    for type in options {
                let item = IGLDropDownItem()
                item.textLabel.font = font
                item.textLabel.textAlignment = .Center
                item.showBackgroundShadow = false
                item.text = type
                items.append(item)
    }
    dropdown.dropDownItems = items
    dropdown.menuText = menuText
    dropdown.type = .Normal
    dropdown.menuButton.textLabel.font = font
    dropdown.menuButton.textLabel.textAlignment = .Center
    dropdown.menuButton.showBackgroundShadow = false
    dropdown.reloadView()
    self.view.addSubview(dropdown)
    self.view.bringSubviewToFront(dropdown)
    

    For my menuButton, the textLabel style is changing properly, but for the items themselves, the textLabel style is not changing at all. Am I missing something?

    I also tried dropdown.reloadView() after self.view.addSubview(dropdown)

    opened by Raymond26 6
  • Unable to set width of IGLDropDownMenuItem

    Unable to set width of IGLDropDownMenuItem

    I am using autolayouts and trying to set the width of IGLDropDownMenu by

    [self.dropdownMenu setFrame:CGRect(0,50,250, 35);
    

    However the menu item doesn't seem to expand. I added background to dropdownmenu for debugging and it shows that initially, dropdownmenu is of the right size but the menu item doesn't expand. And on tap, the DropDownMenu width is also resized to menu item width.

    How do I set width for menuItem? or ensure that the menuItem takes all the space for in dropdownmenu

    opened by niranjan92 5
  • multiple IGLDropDownMenu

    multiple IGLDropDownMenu

    i tried to set multiple IGLDropDownMenu but when i expand first one second menu covers menu item of first dropdown menu.

    can we have some suggestion from your side.

    thanks for very clean and neat example.

    opened by jitz2010 4
  • updating cocoapods

    updating cocoapods

    i've found your lib and added it to my project via cocoapods: https://cocoapods.org/?q=IGLDrop

    unfortunatly there is the storyboard support missing. i've seen you did some change 2 hours ago. when you have finished them, can you please make an update to cocoapods? thanks a lot!

    opened by dermaaarkus 3
  • Added initializer with option to use drop shadow or not

    Added initializer with option to use drop shadow or not

    I am going to use this myself, thought you might want it, let me know because I'd rather it be in the master and in Cocoa Pods

    Thanks for the killer control!

    opened by alivemedia 3
  • Use it with it UIbarButtonItem

    Use it with it UIbarButtonItem

    Hello, I need to know how to implement this Library with UIbarButtonItem ? I've tried to add the dropDownMenu button to the navigationItems but this make my app crash :

    [IGLDropDownMenu _setOwningNavigationItem:]: unrecognized selector sent to instance
    
    opened by chlebta 2
  • Crash: IGLDropDownItem.h

    Crash: IGLDropDownItem.h

    Can you please make the delegate: @property (nonatomic, **weak**) id<IGLDropDownMenuDelegate> delegate;

    My app crashes when the menu is currently open but I dealloc the viewcontroller which is also the delegate.

    Currently I have to manually set the delegate to nil in the viewcontroller's dealloc function

    opened by pjebs 1
  • storyboard custom menu button

    storyboard custom menu button

    When creating a IGLDropDownMenu via storyboards the constructor - (instancetype)initWithCoder:(NSCoder *)aDecoder will be used. that's why it is not possible to init your menu button with a custom view. my quickfix was to remove the readonly property of @property (nonatomic, strong) IGLDropDownItem *menuButton;. then i could set my custom menu button like this:

    CustomDropDownItemView* customViewMenuButton = [[[NSBundle mainBundle] loadNibNamed:@"CustomDropDownItemView" owner:self options:nil] objectAtIndex:0];
    customViewMenuButton.centeredImage.image = [UIImage imageNamed:@"ic_more_blue_36px"];
    IGLDropDownItem* menuButton = [[IGLDropDownItem alloc] initWithCustomView:customViewMenuButton];
    
    self.buttonDropDownMenu.menuButton = menuButton;
    

    i don't know if this is correct in your opinion, but for me it worked. maybe there is another solution?

    opened by dermaaarkus 1
  • Dropdown hides behind the dropdown below it

    Dropdown hides behind the dropdown below it

    I have two drop downs the second one is right below the firs one. When I open the first drop down it's expanded view hides behind the drop down below it. Please suggest a possible solution.

    opened by asimparvez91 1
  • Static menu

    Static menu

    Hi there! Thanks for the great library. For my app I needed to be able to select the menu items but keep the main menu button static, so I added a property menuButtonStatic. I also updated the README to include the feature if you choose to include my feature. I hope you'll consider adding this. Thanks :)

    opened by lukasthoms 1
  • If anyone think it should re-write to a swift version, please leave a comment in this issue.

    If anyone think it should re-write to a swift version, please leave a comment in this issue.

    If anyone think it should re-write to a swift version, please leave a comment to tell me. If this implement in swift, there are two plan:

    1. Just a swift version, no api or struct change, will work fine in your project to replace the objective-c version.
    2. A total new swift version with struct re-write and api change, can implement most of(not all) the old functions and some new effect. But maybe more change for replace the objective-c version.

    Which one you prefer?

    opened by bestwnh 5
  • Add UITapGesture to close menu

    Add UITapGesture to close menu

    I've been trying to figure out how to close the menu when user taps somewhere on the screen. When users don't pick an option, or try to type something in a textField, I want to close the menu to keep the UI clean. How can I achieve this?

    opened by Jackson0111 8
Owner
Galvin Li
A Tiny iOS developer who love to solve problems and make things better.
Galvin Li
UIKit drop down menu, simple yet flexible and written in Swift

DropDownMenuKit DropDownMenuKit is a custom UIKit control to show a menu attached to the navigation bar or toolbar. The menu appears with a sliding an

Quentin Mathé 258 Dec 27, 2022
A Material Design drop down for iOS

A Material Design drop down for iOS written in Swift. Demo Do pod try DropDown in your console and run the project to try a demo. To install CocoaPods

AssistoLab 2.3k Jan 1, 2023
SwiftySideMenu is a lightweight and easy to use side menu controller to add left menu and center view controllers with scale animation based on Pop framework.

SwiftySideMenu SwiftySideMenu is a lightweight, fully customizable, and easy to use controller to add left menu and center view controllers with scale

Hossam Ghareeb 84 Feb 4, 2022
Swift-sidebar-menu-example - Create amazing sidebar menu with animation using swift

 SWIFT SIDEBAR MENU EXAMPLE In this project I create a awesome side bar menu fo

Paolo Prodossimo Lopes 4 Jul 25, 2022
Menu controller with expandable item groups, custom position and appearance animation written with Swift. Similar to ActionSheet style of UIAlertController.

Easy to implement controller with expanding menu items. Design is very similar to iOS native ActionSheet presentation style of a UIAlertController. As

Anatoliy Voropay 22 Dec 27, 2022
A Slide Menu, written in Swift, inspired by Slide Menu Material Design

Swift-Slide-Menu (Material Design Inspired) A Slide Menu, written in Swift 2, inspired by Navigation Drawer on Material Design (inspired by Google Mat

Boisney Philippe 90 Oct 17, 2020
Slide-Menu - A Simple Slide Menu With Swift

Slide Menu!! Весь интерфейс создан через код

Kirill 0 Jan 8, 2022
EasyMenu - SwiftUI Menu but not only button (similar to the native Menu)

EasyMenu SwiftUI Menu but not only button (similar to the native Menu) You can c

null 10 Oct 7, 2022
Hamburger Menu Button - A hamburger menu button with full customization

Hamburger Menu Button A hamburger menu button with full customization. Inspired by VinhLe's idea on the Dribble How to use it You can config the looks

Toan Nguyen 114 Jun 12, 2022
Our Guillotine Menu Transitioning Animation implemented in Swift reminds a bit of a notorious killing machine.

GuillotineMenu.swift Inspired by this project on Dribbble Also, read how it was done in our blog Requirements iOS 8.0+ Xcode 10 Swift 5.0 (v 4.1+) Swi

Yalantis 2.9k Dec 13, 2022
PopMenu is pop animation menu inspired by Sina weibo / NetEase app.

PopMenu PopMenu is pop animation menu inspired by Sina weibo / NetEase app. Screenshots Installation CocoaPods With CocoaPods, add this line to your P

曾宪华 898 Nov 14, 2022
Control your display's brightness from the macOS menu bar. Simple and easy to use.

MonitorControl Lite Control your display's brightness from the macOS menu bar. Simple and easy to use. About MonitorControl Lite is a simplified versi

null 62 Dec 11, 2022
Library provides easy to implement variation of Android (Material Design) Floating Action Button for iOS. You can use it as your app small side menu. 🌶

RHSideButtons ?? Library provides easy to implement variation of Android (Material Design) Floating Action Button for iOS. You can use it as your app

Robert Herdzik 166 Nov 14, 2022
JNDropDownMenu - Easy to use TableView style dropdown menu.

Overview Swift version of https://github.com/dopcn/DOPDropDownMenu Easy to use TableView style dropdown menu. Setup The only thing you

Javal Nanda 65 Jun 27, 2021
An easy way to use `canPerformAction` for context menu in SwiftUI.

Use canPerformAction for TextField/Editor in SwiftUI You know how a TextField displays a set of context menu? It doesn't matter if it's UIKit or Swift

StuFF mc 5 Dec 18, 2021
Easy-to-use action menu

About Navigate Features Installation Usage Delegate Features Highly customizable support dark/light theme corner radius blured background width (iPad)

Vlad Karlugin 4 Jan 6, 2023
Swipable tab and menu View and ViewController.

SwipeMenuViewController Overview SwipeMenuViewController provides SwipeMenuView and SwipeMenuViewController. This is very useful to build swipe-based

Yusuke Morishita 1.2k Dec 29, 2022
Grid and Circular Menu for iOS.

IGCMenu IGCMenu library gives easy way to create Grid and Circular menu in app. This is light weight and highly customisable menu.Support iOS 7 and ab

Sunil Sharma 138 Nov 14, 2022
Hamburger Menu using Swift and iOS 8 API's

FrostedSidebar Hamburger Menu using Swift and iOS 8 API's Heavily influenced by @_ryannystrom's RNFrostedSidebar This implementation uses iOS 8's new

Evan Dekhayser 429 Oct 21, 2022