IOS drop down label selector

Time:2021-6-10

Drop down label selector
DropDownMenuView
Simple drop-down label selector, provides check and deselect, single linked list and double linked list combination, supports proxy configuration picture, can customize configuration

Warehouse address:https://github.com/gu0315/Dro…

Let’s see the effect firstIOS drop down label selector
:

design sketch
Realization idea
The style of each column is set by proxy, the original data is transferred to tableview by proxy, the data is refreshed by collectionview, and the style is changed by each column style

Supported configuration items

final class DMConfiguration {

`///The height of the cell is 44 by default

varcellHeight:CGFloat=44;

///The height of content

var contentViewHeight:CGFloat = 300;

///Adaptive height or not. The default value is false

var isAdaptiveHeight:Bool = false

///Title Color

var textColor:UIColor = UIColor.darkGray

//When there is a secondary list, click row to call the click agent method

var isRefreshWhenHaveRightItem:Bool = false

///Title select color

var highlightedTextColor:UIColor = UIColor.orange

///How many partitions are there

varnumOfMenu:Int=0;

///Font size

varfontSize:CGFloat=15

///Color of the title

vartitleColor:UIColor= .darkGray

///Whether to display split line color. Default display

var isShowSeparator:Bool = true

///Split line proportion height

var separatorHeighPercent:CGFloat = 0.5;

///Split line color

var separatorColor:UIColor = .lightGray

///Indicator icon position, right of default text

var indicatorAlignType:IndicatorAlignType = .IndicatorAlignCloseToTitle

///Background color

varmaskColor:UIColor=UIColor.init(white:0.4, alpha:0.2)

///Change menu title when switching conditions

var isRemainMenuTitle:Bool = true

///Cell text size

varcellTitleFont=UIFont.systemFont(ofSize:14)

init() {

   self.defaultValue()

}

func defaultValue() {

}` 

*   1
*   2
*   3
*   4
*   5
*   6
*   7
*   8
*   9
*   10
*   11
*   12
*   13
*   14
*   15
*   16
*   17
*   18
*   19
*   20
*   21
*   22
*   23
*   24
*   25
*   26
*   27
*   28
*   29
*   30
*   31
*   32
*   33
*   34
*   35
*   36
*   37
*   38
*   39
*   40
*   41
*   42
*   43
*   44
*   45
*   46
*   47
*   48
*   49
*   50
*   51
*   52
*   53
*   54
*   55
*   56
*   57
*   58
*   59
*   60
*   61
*   62
*   63
*   64
*   65
*   66
*   67
*   68
*   69
*   70
*   71
*   72
*   73

}

Proxy callback

@objc public protocol DMenuViewDataSource: NSObjectProtocol {

`///Returns how many columns there are

@objc func numberOfColumnsInMenu(menu:DropDownMenuView) -> Int

///How many pieces of data are there in each column of tableview on the left

@objcfuncnumberOfRowsInColumn(menu:DropDownMenuView, column:Int) ->Int

///Data of each row corresponding to tableview on the left

@objcfunctitleForRowAtIndexPath(menu:DropDownMenuView, column:Int, row:Int) ->DMRowData

///How many pieces of data does the right collectionview or tableview have

@objcoptionalfuncnumberOfRightItemInMenu(menu:DropDownMenuView, column:Int, row:Int) ->Int

///Data of each row corresponding to collectionview or tableview on the right

@objcoptionalfunctitleForRightRowAtIndexPath(menu:DropDownMenuView, column:Int, leftRow:Int,  

rightRow:Int) ->DMRowData

///Returns the type of each column. By default, there is only one tableview

@objc optional func columnTypeInMenu(menu:DropDownMenuView, column: Int) ->   

 DMenuViewColumnType

///Proportion of tableview on the left

@objcoptionalfuncleftTableViewWidthScale(menu:DropDownMenuView, column:Int) ->CGFloat` 

*   1
*   2
*   3
*   4
*   5
*   6
*   7
*   8
*   9
*   10
*   11
*   12
*   13
*   14
*   15
*   16
*   17
*   18
*   19
*   20
*   21
*   22
*   23
*   24
*   25
*   26
*   27
*   28
*   29
*   30
*   31

}

@objc public protocol DMenuViewDelegate: NSObjectProtocol {

`///Click back

@objcoptionalfuncdidSelectRowAtIndexPath(menu:DropDownMenuView, column:Int, leftRow:Int, 

rightRow:Int);` 

*   1
*   2
*   3
*   4
*   5

///Label selection display status

@objcoptionalfuncmenuIsShow(menu:DropDownMenuView, isShow:Bool)

}

Recommended Today

The road of high salary, a more complete summary of MySQL high performance optimization in history

preface MySQL for many linux practitioners, is a very difficult problem, most of the cases are because of the database problems and processing ideas are not clear. Before the optimization of MySQL, we must understand the query process of MySQL. In fact, a lot of query optimization work is to follow some principles so that […]