GithubHelp home page GithubHelp logo

colrying / ghdropmenudemo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from shabake/ghdropmenudemo

0.0 2.0 0.0 6.92 MB

仿京东/美团电商筛选菜单 电商筛选菜单 电商通用筛选菜单

Home Page: https://github.com/shabake/GHDropMenuDemo

License: MIT License

Objective-C 100.00%

ghdropmenudemo's Introduction

GHDropMenu 简单使用 无入侵 对原项目无污染

筛选菜单 京东筛选菜单 美团筛选菜单 电商通用筛选菜单


Untitled.gif


使用方法:

GHDropMenu *dropMenu = [GHDropMenu creatDropMenuWithConfiguration:nil frame:CGRectMake(0, kGHSafeAreaTopHeight,kGHScreenWidth, 44) dropMenuTitleBlock:^(GHDropMenuModel * _Nonnull dropMenuModel) {
        weakSelf.navigationItem.title = [NSString stringWithFormat:@"筛选结果: %@",dropMenuModel.title];
    } dropMenuTagArrayBlock:^(NSArray * _Nonnull tagArray) {
        [weakSelf getStrWith:tagArray];
    }];
    dropMenu.durationTime = 0.5;
    dropMenu.delegate = self;
    dropMenu.dataSource = self;
    [self.view addSubview:dropMenu];

实现数据源方法:

// 返回筛选菜单标题的个数
- (NSArray *)columnTitlesInMeun:(GHDropMenu *)menu {
}

// 返回每列筛选菜单的选项
- (NSArray *)menu:(GHDropMenu *)menu numberOfColumns:(NSInteger)columns {
}

2019.1.6 更新

+ 增加价格输入判断逻辑
	* 小数点最多输入两位
	* 第一位不能输入小数点
	* 增加校验方法,当最小价格大于最大价格弹窗提示并且清空用户输入
	

2018.12.30更新

+ 增加吸附效果的筛选菜单
+ 分别可选tableView悬浮菜单和collectionView悬浮菜单
+ 增加单独侧滑菜单筛选
+ 适配x,xs,xr,xsmax
+ 去掉刚开始创建的动画
+ 自定义筛选标题,自定义筛选内容,自定义筛选标签,自定义筛选头部内容
+ 数组越界处理
+ 价格输入筛选
+ 实现tag标签,单选,多选,取消选中效果
+ 保留上次选中选项
+ 动画展开,移除
+ 可以重新传入模型,重新刷新数据源
+ 选中内容通过代理的方式回调
+ 对原有项目无污染,直接拖进项目即可使用
+ dropMenu的title自适应宽度

- 去掉titleView初始化动画

使用方法

  • GHDropMenu文件夹 拖入项目中
  • 导入 GHDropMenu.h
    /** 配置筛选菜单模型 */
    GHDropMenuModel *configuration = [[GHDropMenuModel alloc]init];
    /** 配置筛选菜单是否记录用户选中 默认NO */
    configuration.recordSeleted = NO;
    /** 设置数据源 */
    configuration.titles = [configuration creaDropMenuData];
    
    /** 创建dropMenu 配置模型 &&frame */
    GHDropMenu *dropMenu = [[GHDropMenu alloc]creatDropMenuWithConfiguration:configuration frame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 44)];
    dropMenu.delegate = self;
    
    [self.view addSubview:dropMenu];
    
  • 需要构造json数据
详见demo
  • 当需要返回上级页面的时候需要调用关闭菜单的方法
- (vold)closeMenu;

接下来要做的

  • 优化代码,完善文档
  • 增加类似boss直聘多级菜单选择

在使用中如有任何问题欢迎*扰我,如果对你有帮助请点帮我一个✨,小弟感激不尽:blush:

关注我的博客 没事写点小东西


Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.