@@ -18,6 +18,10 @@ open class YNDropDownMenu: UIView, YNDropDownDelegate {
1818 private var menuHeight : CGFloat = 0.0
1919 private var numberOfMenu : Int = 0
2020
21+ private var buttonImages : YNImages ?
22+ private var buttonlabelFontColors : YNFontColor ?
23+ private var buttonlabelFonts : YNFont ?
24+
2125 open var blurEffectView : UIView ? {
2226 didSet {
2327 self . changeBlurEffectView ( )
@@ -54,14 +58,6 @@ open class YNDropDownMenu: UIView, YNDropDownDelegate {
5458 open var hideMenuSpringVelocity : CGFloat = 0.9
5559 open var hideMenuSpringWithDamping : CGFloat = 0.8
5660
57- open var labelFontSize : CGFloat ? {
58- didSet {
59-
60- }
61- }
62- private var buttonImages : YNImages ?
63- private var buttonlabelFontColors : YNFontColor ?
64-
6561 public init ( frame: CGRect , dropDownViews: [ YNDropDownView ] , dropDownViewTitles: [ String ] ) {
6662 super. init ( frame: frame)
6763
@@ -89,21 +85,30 @@ open class YNDropDownMenu: UIView, YNDropDownDelegate {
8985
9086 // Use this function when your menu button image is all same
9187 open func setImageWhen( normal: UIImage ? , selected: UIImage ? , disabled: UIImage ? ) {
92- buttonImages = YNImages . init ( normal: normal, selected: selected, disabled: disabled)
88+ self . buttonImages = YNImages . init ( normal: normal, selected: selected, disabled: disabled)
9389
9490 for i in 0 ..< numberOfMenu {
95- dropDownButtons ? [ i] . buttonImages = buttonImages
91+ dropDownButtons ? [ i] . buttonImages = self . buttonImages
9692 }
9793 }
9894
9995 open func setLabelColorWhen( normal: UIColor , selected: UIColor , disabled: UIColor ) {
100- buttonlabelFontColors = YNFontColor . init ( normal: normal, selected: selected, disabled: disabled)
96+ self . buttonlabelFontColors = YNFontColor . init ( normal: normal, selected: selected, disabled: disabled)
10197
10298 for i in 0 ..< numberOfMenu {
103- dropDownButtons ? [ i] . labelFontColors = buttonlabelFontColors
99+ dropDownButtons ? [ i] . labelFontColors = self . buttonlabelFontColors
104100 }
105101 }
106102
103+ open func setLabelFontWhen( normal: UIFont , selected: UIFont , disabled: UIFont ) {
104+ self . buttonlabelFonts = YNFont . init ( normal: normal, selected: selected, disabled: disabled)
105+
106+ for i in 0 ..< numberOfMenu {
107+ dropDownButtons ? [ i] . labelFonts = self . buttonlabelFonts
108+ }
109+
110+ }
111+
107112 open func disabledMenuAt( index: Int ) {
108113 if index > numberOfMenu {
109114 fatalError ( " index should be smaller than menu count " )
@@ -221,6 +226,7 @@ open class YNDropDownMenu: UIView, YNDropDownDelegate {
221226 arrowView. layer. transform = CATransform3DMakeRotation ( CGFloat ( M_PI) , 1.0 , 0.0 , 0.0 )
222227 arrowView. image = self . buttonImages? . selected
223228 yNDropDownButton. buttonLabel. textColor = self . buttonlabelFontColors? . selected
229+ yNDropDownButton. buttonLabel. font = self . buttonlabelFonts? . selected
224230
225231 } , completion: { ( completion) in
226232 guard let block = didComplete else { return }
@@ -246,7 +252,8 @@ open class YNDropDownMenu: UIView, YNDropDownDelegate {
246252 arrowView. layer. transform = CATransform3DMakeRotation ( CGFloat ( M_PI) , 0.0 , 0.0 , 0.0 ) ;
247253 arrowView. image = self . buttonImages? . normal
248254 yNDropDownButton. buttonLabel. textColor = self . buttonlabelFontColors? . normal
249-
255+ yNDropDownButton. buttonLabel. font = self . buttonlabelFonts? . normal
256+
250257 } , completion: { ( completion) in
251258 if self . backgroundBlurEnabled {
252259 self . blurEffectView? . removeFromSuperview ( )
0 commit comments