主流的篩選菜單不少都是固定樣式的,不少時候要使用都要去改變源碼才能變成咱們想要的樣子,因而我就想寫一個控件,只須要調用代理就能實現幾乎全部功能的篩選功能git
#目前已經用這控件實現的效果圖 ⚠️⚠️⚠️⚠️無須改變源碼 只須要調用個人代理組合功能便可⚠️⚠️⚠️⚠️github
#我手機只有這麼一些app了。。~ ~ 總之,目前的app的篩選樣式幾乎都能實現,固然細節要本身去調編程
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;
複製代碼
參數 | 類型 | 做用 (默認值) |
---|---|---|
wBorderShow | BOOL | 標題視圖是否顯示邊框 default NO |
wFixBtnWidth | CGFLoat | 固定標題的寬度 default 80 |
wMenuTitleEqualCount | NSInteger | 標題等分個數 用來控制標題的寬度 default 4 |
wMenuLine | BOOL | 標題按鈕添加下劃線 dfault NO |
###彈出視圖相關相關app
參數 | 類型 | 做用 (默認值) |
---|---|---|
wFixDataViewHeight | CGFLoat | 固定彈出顯示數據層的高度 default 自動計算~>最大爲屏幕高度的0.4倍 |
wMainRadius | CGFLoat | 彈窗視圖的圓角 默認0 |
wMaxWidthScale | CGFLoat | 最大屏幕寬度係數 default 0.9 |
wMaxHeightScale | CGFLoat | 最大屏幕高度係數 default 0.4 |
wDefaultConfirmHeight | CGFLoat | 默認肯定重置視圖的高度 default 40 |
wPopViewWidth | CGFLoat | 彈出動畫爲pop時候 視圖的寬度 default 屏幕寬度/3 |
wShadowColor | UIColor | 遮罩層顏色 default 333333 |
wShadowAlpha | CGFLoat | 遮罩層透明度 default 0.4 |
wShadowCanTap | BOOL | 遮罩層可否點擊 default YES |
wShadowShow | BOOL | 遮罩層是否顯示 default YES |
參數 | 類型 | 做用 (默認值) |
---|---|---|
wTableViewColor | NSArray | tableview的顏色 default @[FFFFFF,F6F7FA,EBECF0,FFFFFF] |
wTextAlignment | NSTextAlignment | cell文本居中樣式 default left |
wCellSelectShowCheck | BOOL | tableViewCell 選中顯示打鉤圖片 default YES |
參數 | 類型 | 做用 (默認值) |
---|---|---|
wReginerCollectionCells | NSArray | 註冊自定義的collectionViewCell 若是使用了自定義collectionView 必填不然會崩潰 |
wReginerCollectionHeadViews | NSArray | 註冊自定義的collectionViewHeadView 若是使用了自定義collectionViewHeadView 必填 |
wReginerCollectionFootViews | NSArray | 註冊自定義的collectionViewFoootView 若是使用了自定義collectionViewFoootView 必填 |
wCollectionViewCellSpace | CGFloat | colletionCell的間距 default 10 |
wCollectionViewCellBgColor | UIColor | colletionCell背景顏色 default 0x666666 |
wCollectionViewCellTitleColor | UIColor | colletionCell文字顏色 default 0xf2f2f2 |
wCollectionViewCellSelectBgColor | UIColor | colletionCell選中背景顏色 default 0xffeceb |
wCollectionViewCellSelectTitleColor | UIColor | colletionCell選中文字顏色 default red |
wCollectionViewCellBorderWith | CGFloat | colletionCell borderWidth default 0 |
wCollectionViewSectionShowExpandCount | NSInteger | colletionView section 超過多少個cell顯示收縮按鈕 default 6 |
wCollectionViewSectionRecycleCount | NSInteger | colletionView section 回收時候顯示的cell數量 default 0 |
wCollectionViewDefaultFootViewMarginY | CGFloat | colletionViewFootView 距離底部的距離 默認0 當iphonex機型爲 20 |
wCollectionViewDefaultFootViewPaddingY | CGFloat | colletionViewFootView 距離頂部的距離 默認0 |
無任何依賴iphone
pod 'WMZDropDownMenu'
。pod install
或 pod update
。要在Buildding Settings 把CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF 設爲NOide
使用過程當中若是有什麼bug或者使用的問題歡迎給我提issue或者加我qq 我看到就會解決 以爲有用的話給個star GitHub地址動畫