实现仿新浪下拉菜单

该程序主要分为三个模块:html模块、css模块、js模块

本程序运行成功截图如下:

 

1、html模块:分为上下两个部分,上面为导航栏,下面为鼠标经过导航栏所下拉出现的部分。这里要为下拉的部分先设置为不可见样式,之后再js中设置鼠标经过可见。代码如下:

2、css模块:在此处设置相应的样式

3、最后是js模块:需要先获取元素,然后设置相应html模块鼠标经过可见,离开不可见

 

 

源码HyPopMenuView,该案例HyPopMenuView模仿新浪微博弹出菜单, Manually Import【手动导入】 【将HyPopMenuView,UIColor ImageGetColor,MenuLabel所有源代码拽入项目中】 【导入主头文件:#import "HyPopMenuView.h"】 HyPopMenuView.h HyPopMenuView.m UIColor ImageGetColor.h UIColor ImageGetColor.m MenuLabel.h MenuLabel.m Example【示例】 NSArray *Objs = @[ [MenuLabel CreatelabelIconName:@"tabbar_compose_idea" Title:@"文字"], [MenuLabel CreatelabelIconName:@"tabbar_compose_photo" Title:@"相册"], [MenuLabel CreatelabelIconName:@"tabbar_compose_camera" Title:@"拍摄"], [MenuLabel CreatelabelIconName:@"tabbar_compose_lbs" Title:@"签到"], [MenuLabel CreatelabelIconName:@"tabbar_compose_review" Title:@"点评"], [MenuLabel CreatelabelIconName:@"tabbar_compose_more" Title:@"更多"], ]; CGFloat x,y,w,h; x = CGRectGetWidth(self.view.bounds)/2 - 213/2; y = CGRectGetHeight([UIScreen mainScreen].bounds)/2 * 0.3f; w = 213; h = 57; //自定义的头部视图 UIImageView *topView = [[ImageView alloc] initWithFrame:CGRectMake(x, y, w, h)]; topView.image = [UIImage imageNamed:@"compose_slogan"]; topView.contentMode = UIViewContentModeScaleAspectFit; NSMutableDictionary *AudioDictionary = [NSMutableDictionary dictionary]; //添加弹出菜单音效 [AudioDictionary setObject:@"composer_open" forKey:kHyPopMenuViewOpenAudioNameKey]; [AudioDictionary setObject:@"wav" forKey:kHyPopMenuViewOpenAudioTypeKey]; //添加取消菜单音效 [AudioDictionary setObject:@"composer_close" forKey:kHyPopMenuViewCloseAudioNameKey]; [AudioDictionary setObject:@"wav" forKey:kHyPopMenuViewCloseAudioTypeKey]; //添加选中按钮音效 [AudioDictionary setObject:@"composer_select" forKey:kHyPopMenuViewSelectAudioNameKey]; [AudioDictionary setObject:@"wav" forKey:kHyPopMenuViewSelectAudioTypeKey]; [HyPopMenuView CreatingPopMenuObjectItmes:Objs TopView:topView OpenOrCloseAudioDictionary:Audio
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值