IGLDropDownMenu

An iOS drop down menu with pretty animation.

一种iOS点击下拉菜单样式,动画效果很绚丽。

Screenshot - 截图

How To Use - 如何使用

!Try the demo. It's really helpful! 试试demo,看看效果哦!

Sample Code - 示例源码

  1. Create your IGLDropDownItem array and set up 创建IGLDropDownItem数组然后进行设置

    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,设置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 修改IGLDropDownMenu的参数

    dropDownMenu.type = IGLDropDownMenuTypeStack;
    dropDownMenu.gutterY = 5;
    dropDownMenu.itemAnimationDelay = 0.1;
    dropDownMenu.rotate = IGLDropDownMenuRotateRandom;
  4. Call the reloadView method (Very Important!) 执行reloadView(非常重要!)

    // 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 设置每个item的延时动画时间

  • 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
  • slidingInOffset set the offset value for the items slide in and out 设置item滑进来时候的偏移量

  • gutterY set the Y gutter between items 设置item之间的间隔
  • 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 当你设置这个值为true,这个按钮会向上翻
  • useSpringAnimation use the spring animation for iOS7 or higher version, default is true 使用spring动画效果,默认开启

For IGLDropDownItem

  • iconImage set the icon image for the item 设置item的图片
  • text set the text string for the item 设置text
  • textLabel for you to adjust the text label style 方便你设置调整Label样式
  • object you can store your custom item in this preporty 你可以用它来存储你的自定义item

Remember the menuButton in IGLDropDownMenu is also an IGLDropDownItem.

请记住,在IGLDropDownMenu中,menuButton也是IGLDropDownItem。

Requirements - 需要

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

TODO - 以后要做的事情

  1. make IGLDropDownItem more customizable 让IGLDropDownItem可定制程度更高
  2. add the spring animation for iOS 7 or higher version
  3. add more animation effect for the menu 更多的动画效果
  4. just contact me and tell me more 联系我,给我建议帮我改进

Thanks - 感谢

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

这个菜单的主意来自于 here,我发现了这个demo后,然后在iOS上实现了。

[翻译] IGLDropDownMenu的更多相关文章

  1. 《Django By Example》第五章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者@ucag注:大家好,我是新来的翻译, ...

  2. 《Django By Example》第四章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:祝大家新年快乐,这次带来<D ...

  3. [翻译]开发文档:android Bitmap的高效使用

    内容概述 本文内容来自开发文档"Traning > Displaying Bitmaps Efficiently",包括大尺寸Bitmap的高效加载,图片的异步加载和数据缓存 ...

  4. 【探索】机器指令翻译成 JavaScript

    前言 前些时候研究脚本混淆时,打算先学一些「程序流程」相关的概念.为了不因太枯燥而放弃,决定想一个有趣的案例,可以边探索边学. 于是想了一个话题:尝试将机器指令 1:1 翻译 成 JavaScript ...

  5. 《Django By Example》第三章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:第三章滚烫出炉,大家请不要吐槽文中 ...

  6. 《Django By Example》第二章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:翻译完第一章后,发现翻译第二章的速 ...

  7. 《Django By Example》第一章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:本人目前在杭州某家互联网公司工作, ...

  8. 【翻译】Awesome R资源大全中文版来了,全球最火的R工具包一网打尽,超过300+工具,还在等什么?

    0.前言 虽然很早就知道R被微软收购,也很早知道R在统计分析处理方面很强大,开始一直没有行动过...直到 直到12月初在微软技术大会,看到我软的工程师演示R的使用,我就震惊了,然后最近在网上到处了解和 ...

  9. ASP.NET MVC with Entity Framework and CSS一书翻译系列文章之第一章:创建基本的MVC Web站点

    在这一章中,我们将学习如何使用基架快速搭建和运行一个简单的Microsoft ASP.NET MVC Web站点.在我们马上投入学习和编码之前,我们首先了解一些有关ASP.NET MVC和Entity ...

随机推荐

  1. Jmeter创建一个 JMS 主题的测试计划

    新建一个 JMS 主题的测试计划 JMS 需要下载一些可选的jar 文件.详细信息请参阅 第一章:新手入门.在本章节,将学习如何创建测试计划来测试JMS提供程序.创建5个订阅者和1个发布者.创建2个线 ...

  2. c++面试题中经常被面试官面试的小问题总结(二)(本篇偏向指针知识)

    原文作者:aircraft 原文链接:https://www.cnblogs.com/DOMLX/p/10713204.html 1.利用指针交换两个字符串方法?(这题是我当年读大一的时候看到的,好怀 ...

  3. file_get_contents 抓取网页乱码。

    iconv string iconv ( string $in_charset , string $out_charset , string $str ) mb_convert_encoding st ...

  4. GBK 编码

    GBK编码范围:8140-FEFE,汉字编码范围见第二节:码位分配及顺序. GBK编码,是对GB2312编码的扩展,因此完全兼容GB2312-80标准.GBK编码依然采用双字节编码方案,其编码范围:8 ...

  5. Android Anwendungsprogramm Entwicklung

    1.Einführung des Androids 1.1 Grundlage der Anwendung Activity ist eine Spezifische Bespiel von Andr ...

  6. XRP(瑞波币)账户管理系统

    目录 账户管理 分配常规密钥对 修改或移除常规密钥对 设置多重签名 发送多签名交易 账户管理 分配常规密钥对 XRP Ledger允许帐户授权二级密钥对(称为常规密钥对)来对未来的交易进行签名, 如果 ...

  7. 【转】C#微信公众平台开发者模式开启代码

    using System; using System.IO; using System.Text; using System.Web.Security; namespace HPZJ.Web.sys. ...

  8. CPU缓存一致性协议与java中的volatile关键字

    有关缓存一致性协议MESI自行百度. 提出问题:volatile在缓存一致性协议上又做了哪些事情?为啥它不保证原子性? 在缓存一致性协议下,CPU为了执行效率使用了写(存储)缓存和失效队列从而导致对用 ...

  9. 从0开始整合SSM框架--2.spring整合mybatis

    依赖:<properties> <!-- spring版本号 --> <spring.version>4.1.3.RELEASE</spring.versio ...

  10. 小白学习之Code First(一)

    1.根据自己的理解,Code First :通过实体类和相关配置生成对应的数据库,实现实体和数据库的映射关系,或通过实体类和相关配置与已经生成的实体与已经存在的数据库搭建映射关系 例: 实体类:Stu ...