注册

iOS- WMZDropDownMenu:App各种类型筛选菜单

软件介绍

一个能几乎实现所有 App 各种类型筛选菜单的控件,可悬浮。目前已实现 闲鱼 / 美团 / Boss直聘 / 京东 / 饿了么 / 淘宝 / 拼多多 / 赶集网 / 美图外卖 等等的筛选菜单,可以自由调用代理实现自己想组装的筛选功能和 UI,且控件的生命周期自动管理,悬浮自动管理。

实现功能

  • 组合自定义功能
  • 支持自定义多选|单选|复选
  • 支持自定义弹出的动画 (目前已实现向下,向左全屏,向右全屏,拼多多对话框弹出,boss直聘全屏弹出)
  • 支持自定义tableView/collectionView头尾视图
  • 支持自定义全局头尾视图
  • 支持自定义collectionCell/tableViewCell视图
  • 支持自定义标题
  • 支持自定义点击回收视图
  • 支持自定义回收列表
  • 支持任意级的联动(由于数据比较庞杂,暂时自动适配不了无限级的联动,所以需要你调用一个方法更新数据传给我,详情看Demo)
  • 支持嵌套使用,即两个筛选菜单可以连着使用
  • 支持放在放在任意视图上,tableviewHeadView毫无疑问支持且无须写其他代码只要放上去即可
  • 支持控制器消失自动关闭视图,无须再控制器消失方法里手动关闭
  • 链式实现所有配置的自定义修改 (总之,你想要的基本都有,不想要的也有)

效果图

ad22b112438e1ee72fa863c1c0eac801.gif

用法:

组装全在一些代理里,代理方法可能有点多~ ~,不过只有两个是必实现的,其他的都是可选的)

WMZDropMenuDelegate 
@required 一定实现的方法
*/
- (NSArray*)titleArrInMenu:(WMZDropDownMenu *)menu;
/*
*返回WMZDropIndexPath每行 每列的数据
*/
- (NSArray*)menu:(WMZDropDownMenu *)menu
dataForRowAtDropIndexPath:(WMZDropIndexPath*)dropIndexPath;
@optional 可选实现的方法
/*
*返回setion行标题有多少列 默认1列
*/
- (NSInteger)menu:(WMZDropDownMenu *)menu numberOfRowsInSection:
(NSInteger)section;
/*
*自定义tableviewCell内容 默认WMZDropTableViewCell 如果要使用默认的
cell返回 nil
*/
- (UITableViewCell*)menu:(WMZDropDownMenu *)menu
cellForUITableView:(WMZDropTableView*)tableView AtIndexPath:
(NSIndexPath*)indexpath dataForIndexPath:(WMZDropTree*)model;
/*
*自定义tableView headView
*/
- (UITableViewHeaderFooterView*)menu:(WMZDropDownMenu *)menu
headViewForUITableView:(WMZDropTableView*)tableView
AtDropIndexPath:(WMZDropIndexPath*)dropIndexPath;
/*
*自定义tableView footView
*/
- (UITableViewHeaderFooterView*)menu:(WMZDropDownMenu *)menu
footViewForUITableView:(WMZDropTableView*)tableView
AtDropIndexPath:(WMZDropIndexPath*)dropIndexPath;

/*
*自定义collectionViewCell内容
*/
- (UICollectionViewCell*)menu:(WMZDropDownMenu *)menu
cellForUICollectionView:(WMZDropCollectionView*)collectionView
AtDropIndexPath:(WMZDropIndexPath*)dropIndexPath AtIndexPath:
(NSIndexPath*)indexpath dataForIndexPath:(WMZDropTree*)model;
/*
*自定义collectionView headView
*/
- (UICollectionReusableView*)menu:(WMZDropDownMenu *)menu
headViewForUICollectionView:(WMZDropCollectionView*)collectionView
AtDropIndexPath:(WMZDropIndexPath*)dropIndexPath AtIndexPath:
(NSIndexPath*)indexpath;

/*
*自定义collectionView footView
*/
- (UICollectionReusableView*)menu:(WMZDropDownMenu *)menu
footViewForUICollectionView:(WMZDropCollectionView*)collectionView
AtDropIndexPath:(WMZDropIndexPath*)dropIndexPath AtIndexPath:
(NSIndexPath*)indexpath;

/*
*headView标题
*/
- (NSString*)menu:(WMZDropDownMenu *)menu
titleForHeadViewAtDropIndexPath:(WMZDropIndexPath*)dropIndexPath;
/*
*footView标题
*/
- (NSString*)menu:(WMZDropDownMenu *)menu
titleForFootViewAtDropIndexPath:(WMZDropIndexPath*)dropIndexPath;


/*
*返回WMZDropIndexPath每行 每列 indexpath的cell的高度 默认35
*/
- (CGFloat)menu:(WMZDropDownMenu *)menu heightAtDropIndexPath:
(WMZDropIndexPath*)dropIndexPath AtIndexPath:
(NSIndexPath*)indexpath;
/*
*自定义headView高度 collectionView默认35
*/
- (CGFloat)menu:(WMZDropDownMenu *)menu
heightForHeadViewAtDropIndexPath:(WMZDropIndexPath*)dropIndexPath;
/*
*自定义footView高度
*/
- (CGFloat)menu:(WMZDropDownMenu *)menu
heightForFootViewAtDropIndexPath:(WMZDropIndexPath*)dropIndexPath;

#pragma -mark 自定义用户交互的每行的头尾视图
/*
*自定义每行全局头部视图 多用于交互事件
*/
- (UIView*)menu:(WMZDropDownMenu *)menu
userInteractionHeadViewInSection:(NSInteger)section;
/*
*自定义每行全局尾部视图 多用于交互事件
*/
- (UIView*)menu:(WMZDropDownMenu *)menu
userInteractionFootViewInSection:(NSInteger)section;
#pragma -mark 样式动画相关代理
/*
*返回WMZDropIndexPath每行 每列的UI样式 默认MenuUITableView
注:设置了dropIndexPath.section 设置了 MenuUITableView 那么row则全部
为MenuUITableView 保持统一风格
*/
- (MenuUIStyle)menu:(WMZDropDownMenu *)menu
uiStyleForRowIndexPath:(WMZDropIndexPath*)dropIndexPath;
/*
*返回section行标题数据视图出现的动画样式 默认
MenuShowAnimalBottom
注:最后一个默认是筛选 弹出动画为 MenuShowAnimalRight
*/
- (MenuShowAnimalStyle)menu:(WMZDropDownMenu *)menu
showAnimalStyleForRowInSection:(NSInteger)section;
/*
*返回section行标题数据视图消失的动画样式 默认 MenuHideAnimalTop
注:最后一个默认是筛选 消失动画为 MenuHideAnimalLeft
*/
- (MenuHideAnimalStyle)menu:(WMZDropDownMenu *)menu
hideAnimalStyleForRowInSection:(NSInteger)section;
/*
*返回WMZDropIndexPath每行 每列的编辑类型 单选|多选 默认单选
*/
- (MenuEditStyle)menu:(WMZDropDownMenu *)menu
editStyleForRowAtDropIndexPath:(WMZDropIndexPath*)dropIndexPath;
/*
*返回WMZDropIndexPath每行 每列 显示的个数
注:
样式MenuUITableView 默认4个
样式MenuUICollectionView 默认1个 传值无效
*/
- (NSInteger)menu:(WMZDropDownMenu *)menu
countForRowAtDropIndexPath:(WMZDropIndexPath*)dropIndexPath;
/*
*WMZDropIndexPath是否显示收缩功能 default >参数
wCollectionViewSectionShowExpandCount 显示
*/
- (BOOL)menu:(WMZDropDownMenu *)menu
showExpandAtDropIndexPath:(WMZDropIndexPath*)dropIndexPath;

/*
*WMZDropIndexPath上的内容点击 是否关闭视图 default YES
*/
- (BOOL)menu:(WMZDropDownMenu *)menu
closeWithTapAtDropIndexPath:(WMZDropIndexPath*)dropIndexPath;

/*
*是否关联 其他标题 即选中其他标题 此标题会不会取消选中状态 default
YES 取消,互不关联
*/
- (BOOL)menu:(WMZDropDownMenu *)menu
dropIndexPathConnectInSection:(NSInteger)section;

#pragma -mark 交互自定义代理
/*
*cell点击方法
*/
- (void)menu:(WMZDropDownMenu *)menu
didSelectRowAtDropIndexPath:(WMZDropIndexPath *)dropIndexPath
dataIndexPath:(NSIndexPath*)indexpath data:(WMZDropTree*)data;
/*
*标题点击方法
*/
- (void)menu:(WMZDropDownMenu *)menu didSelectTitleInSection:
(NSInteger)section btn:(WMZDropMenuBtn*)selectBtn;
/*
*确定方法 多个选择
selectNoramalData 转化后的的模型数据
selectData 字符串数据
*/
- (void)menu:(WMZDropDownMenu *)menu didConfirmAtSection:
(NSInteger)section selectNoramelData:(
NSMutableArray*)selectNoramalData selectStringData:
(NSMutableArray*)selectData;


/*
*自定义标题按钮视图 返回配置 参数说明
offset 按钮的间距
y 按钮的y坐标 自动会居中
*/
- (NSDictionary*)menu:(WMZDropDownMenu *)menu
customTitleInSection:
(NSInteger)section withTitleBtn:(WMZDropMenuBtn*)menuBtn;

/*
*自定义修改默认collectionView尾部视图
*/
- (void)menu:(WMZDropDownMenu *)menu
customDefauultCollectionFootView:(WMZDropConfirmView*)confirmView;

下载地址:https://gitee.com/mirrors/WMZDropDownMenu

0 个评论

要回复文章请先登录注册