Git Product home page Git Product logo

mmcombobox's Introduction

MMComboBox.png

Features

  • 支持单层的单选和多选
  • 支持两层联动筛选
  • 支持三层联动筛选
  • 支持混合模式的单选和多选

Requirements

  • iOS 7.0 or later

Installation

cloning the MMComboBox folder into your repository

Rrchitecture(工程结构图)

结构图.png

Example code

1.导入头文件:

#import "MMComBoBox.h"

1.初始化视图:

 MMComBoBoxView *view = [[MMComBoBoxView alloc] initWithFrame:CGRectMake(0, 64, kScreenWidth, 40)];
    view.dataSource = self;
    view.delegate = self;
    [self.view addSubview:view];
    [view reload];

2.通过datasource协议将数据传给MMComBoBoxView,你可以联想UITableView数据驱动方式就可以了。

#pragma mark - MMComBoBoxViewDataSource
- (NSUInteger)numberOfColumnsIncomBoBoxView :(MMComBoBoxView *)comBoBoxView {
    return self.mutableArray.count;
}

- (MMItem *)comBoBoxView:(MMComBoBoxView *)comBoBoxView infomationForColumn:(NSUInteger)column {
    return self.mutableArray[column];
}

3.我们会通过MMComBoBoxViewDelegate协议把选中的路径回调出来,这里我们选择回调存储路径的数组的本质是在于可能开发人员上传的不止是title,可能还有对应的code等一系列的字段。这样方便扩展。

#pragma mark - MMComBoBoxViewDelegate
- (void)comBoBoxView:(MMComBoBoxView *)comBoBoxViewd didSelectedItemsPackagingInArray:(NSArray *)array atIndex:(NSUInteger)index;

Example gif

example.gif

mmcombobox's People

Contributors

yywdark avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mmcombobox's Issues

每次点击弹框视图层都会增加一层透明view

看一下觉得应该是弹框添加阴影背景在消除时未消掉只是修改了透明度,看了下源码确实是这样,一开始是想在popupViewWillDismiss这个代理方法里面让shadowView从父类中移除,这样方便一句代码.然后觉得应该在消除弹框透明度改变的时候就直接移除,然后在继承至MMBasePopupView的三种弹框方式中的dismiss方法中消失动画结束后添加移除,达到目的.

rowNumber和columnNumber含义错误

在读MMLayout.m源码,发现如下问题:
1.rowNumber和columnNumber含义错误
rowNumber含义是行数,但在您代码中表示最大的列数
columnNumber含义是列数,但在您代码中表示行数
含义完全相反
2.求行数算法可以优化下:行数 = (m+n-1)/n (m表示item的个数,n表示最大的列数)

默认选中去掉,selectedArray为空没做异常判断

如果去掉默认选中值
[rootItem2 addNode:[MMItem itemWithItemType:MMPopupViewDisplayTypeSelected isSelected:NO titleName:@"排序" subtitleName:nil code:nil]];
将 isSelected 传参为 NO ,没有做数组为空逻辑判断,导致闪退,在MMSingleFitlerView 类中didSelectRowAtIndexPath第204行,需要做下为空兼容处理

reload方法问题

reload方法每调用一次都会运行addSubView方法,导致覆盖上多层重复视图后显示效果上会有变化,比如字体颜色显得很重,我猜要先remove掉视图中的MMDropDownBox对象再重新添加

默认选择值的问题

没有给FilterView设置默认选择值时,点击选择某项会崩溃,查看代码是FilterView中didSelectRowAtIndexPath方法移除旧的选择项时没有判断selectedArray,直接取了selectedArray的值

正向UI赋值

请问一下 我想进入页面的时候就加载指定的排序和筛选条件怎么给列表赋值啊。调用comBoBoxView:didSelectedItemsPackagingInArray:atIndex不能实现额。

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.