Skip to content

Commit aff9880

Browse files
committed
prepare for v1.2.1
1 parent f4db357 commit aff9880

File tree

9 files changed

+59
-25
lines changed

9 files changed

+59
-25
lines changed

CHANGELOG.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,11 @@ it, simply add the following line to your Podfile:
55

66
`pod 'YNDropDownMenu'`
77

8-
## 1.2.0 (2017-02-24)
9-
10-
##### Enhancements
8+
## [v1.2.1](https://github.com/younatics/YNDropDownMenu/releases/tag/v1.2.1)
9+
* Customize UIFont
1110

11+
## [v1.2.0](https://github.com/younatics/YNDropDownMenu/releases/tag/v1.2.0)
1212
* Inherit YNDropDownView instead of UIView to add views for YNDropDownMenu
1313
* Available to call hideMenu in YNDropDownView
1414
* Support Carthage [#1](https://github.com/younatics/YNDropDownMenu/issues/1)
1515

16-
##### Bug Fixes
17-
18-
* None.
19-

Example/Pods/Pods.xcodeproj/project.pbxproj

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.

Example/YNDropDownMenu/ViewController.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class ViewController: UIViewController {
2020
let view = YNDropDownMenu(frame: CGRect(x: 0, y: 64, width: UIScreen.main.bounds.size.width, height: 38), dropDownViews: _ZBdropDownViews, dropDownViewTitles: ["Apple", "Banana", "Kiwi", "Pear"])
2121
view.setImageWhen(normal: UIImage(named: "arrow_nor"), selected: UIImage(named: "arrow_sel"), disabled: UIImage(named: "arrow_dim"))
2222
view.setLabelColorWhen(normal: UIColor.black, selected: FFA409, disabled: UIColor.gray)
23+
view.setLabelFontWhen(normal: UIFont.systemFont(ofSize: 12), selected: UIFont.boldSystemFont(ofSize: 12), disabled: UIFont.systemFont(ofSize: 12))
2324

2425
view.backgroundBlurEnabled = false
2526

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
![Language](https://img.shields.io/badge/language-Swift-brightgreen.svg?style=flat)
1010

1111
## Congratulation!
12-
- Recorded 4th in Trending in open source 2017.02.24
13-
- Recorded 5th in Trending developers 2017.02.24
12+
- Recorded 2nd in Trending in open source 2017.02.24
13+
- Recorded 4th in Trending developers 2017.02.24
1414

1515
- Recorded 7th in Trending in open source 2017.02.23
1616
- Recorded 11th in Trending developers 2017.02.23

YNDropDownMenu.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
Pod::Spec.new do |s|
1010
s.name = 'YNDropDownMenu'
11-
s.version = '1.2.0'
11+
s.version = '1.2.1'
1212
s.summary = 'YNDropDownMenu is created to make drop down menu with Swift 3'
1313

1414
s.description = The eligible dropdown menu, written in Swift 3, appears dropdown menu to display a view of related items when a user click on the dropdown menu. You can customize dropdown view whatever you like (e.g. UITableView, UICollectionView... etc)

YNDropDownMenu/Classes/YNDropDownButton.swift

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,16 @@ class YNDropDownButton: UIButton {
1919
self.initViewWithImage()
2020
}
2121
}
22-
open var labelFontColors: YNFontColor?
22+
open var labelFontColors: YNFontColor? {
23+
didSet {
24+
self.initFontColor()
25+
}
26+
}
27+
open var labelFonts: YNFont? {
28+
didSet {
29+
self.initFont()
30+
}
31+
}
2332

2433
override init(frame: CGRect) {
2534
super.init(frame: frame)
@@ -47,6 +56,9 @@ class YNDropDownButton: UIButton {
4756
if let _fontColor = labelFontColors?.normal {
4857
self.buttonLabel.textColor = _fontColor
4958
}
59+
if let _font = labelFonts?.normal {
60+
self.buttonLabel.font = _font
61+
}
5062
self.isUserInteractionEnabled = true
5163
}
5264

@@ -57,9 +69,21 @@ class YNDropDownButton: UIButton {
5769
if let _fontColor = labelFontColors?.disabled {
5870
self.buttonLabel.textColor = _fontColor
5971
}
72+
if let _font = labelFonts?.disabled {
73+
self.buttonLabel.font = _font
74+
}
6075
self.isUserInteractionEnabled = false
6176
}
6277

78+
private func initFontColor() {
79+
guard let _labelFontColors = labelFontColors else { return }
80+
self.buttonLabel.textColor = _labelFontColors.normal
81+
}
82+
83+
private func initFont() {
84+
guard let _labelFonts = labelFonts else { return }
85+
self.buttonLabel.font = _labelFonts.normal
86+
}
6387

6488
private func initViewWithImage() {
6589
self.removeConstraints([centerXwithOffsetConstraint, centerYConstraint])

YNDropDownMenu/Classes/YNDropDownMenu.swift

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -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()

YNDropDownMenu/Classes/YNStatus.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,9 @@ struct YNFontColor {
2020
var disabled: UIColor?
2121
}
2222

23+
struct YNFont {
24+
var normal: UIFont?
25+
var selected: UIFont?
26+
var disabled: UIFont?
27+
}
28+

0 commit comments

Comments
 (0)