IGLDropDownMenu

An iOS drop down menu with pretty animation.
一种iOS点击下拉菜单样式,动画效果很绚丽。

How To Use - 如何使用
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];
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
modify the params of IGLDropDownMenu 修改IGLDropDownMenu的参数
dropDownMenu.type = IGLDropDownMenuTypeStack;
dropDownMenu.gutterY = 5;
dropDownMenu.itemAnimationDelay = 0.1;
dropDownMenu.rotate = IGLDropDownMenuRotateRandom;
Call the reloadView method (Very Important!) 执行reloadView(非常重要!)
// every time you change the params you should call reloadView method
[dropDownMenu reloadView];
These are just some of the parameters you can use, you can find more(or make more) in the code.
你可以使用很多很多的参数,详情请参考源码吧。
IGLDropDownMenuanimationDuration 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 设置菜单展开的方向
IGLDropDownMenuDirectionDowndefault value, expand downwardIGLDropDownMenuDirectionUpexpand upward
rotate set the rotate style when the menu on expand 设置菜单展开时候的旋转风格
IGLDropDownMenuRotateNonedefault value, for no rotateIGLDropDownMenuRotateLeftrotate to left on expandIGLDropDownMenuRotateRightrotate to right on expandIGLDropDownMenuRotateRandomrotate 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.) 设置菜单样式
IGLDropDownMenuTypeNormaldefault value, item will hide behind the menu button on foldIGLDropDownMenuTypeStackitem will hide behind the menu button and make a stack like lookIGLDropDownMenuTypeSlidingInBothitem will slide in and out from both sidesIGLDropDownMenuTypeSlidingInFromLeftitem will slide in from leftIGLDropDownMenuTypeSlidingInFromRightitem 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动画效果,默认开启IGLDropDownItemiconImage set the icon image for the item 设置item的图片text set the text string for the item 设置texttextLabel for you to adjust the text label style 方便你设置调整Label样式object you can store your custom item in this preporty 你可以用它来存储你的自定义itemRemember the menuButton in IGLDropDownMenu is also an IGLDropDownItem.
请记住,在IGLDropDownMenu中,menuButton也是IGLDropDownItem。
IGLDropDownItem more customizable 让IGLDropDownItem可定制程度更高
This drop-down menu idea is come from here, I found this demo one day and just implement it on iOS.
这个菜单的主意来自于 here,我发现了这个demo后,然后在iOS上实现了。
原文:http://www.cnblogs.com/YouXianMing/p/4191068.html