|
8 | 8 |
|
9 | 9 | import UIKit |
10 | 10 |
|
| 11 | +/// Button status |
| 12 | +public enum YNStatus { |
| 13 | + case normal |
| 14 | + case selected |
| 15 | + case disabled |
| 16 | +} |
| 17 | + |
11 | 18 | /// Main Class for YNDropDownMenu |
12 | 19 | open class YNDropDownMenu: UIView, YNDropDownDelegate { |
13 | 20 | internal var opened: Bool = false |
@@ -210,16 +217,46 @@ open class YNDropDownMenu: UIView, YNDropDownDelegate { |
210 | 217 | /** |
211 | 218 | Change menu title you called. you can call it in YNDropDownMenu or YNDropDownView |
212 | 219 |
|
| 220 | + - Parameter title: Menu title |
213 | 221 | - Parameter index: Index should be smaller than your menu counts |
214 | 222 | */ |
215 | 223 | open func changeMenu(title: String, at index: Int) { |
216 | 224 | dropDownButtons?[index].buttonLabel.text = title |
| 225 | + } |
| 226 | + |
| 227 | + /** |
| 228 | + Change menu title you called. you can call it in YNDropDownMenu or YNDropDownView |
| 229 | + |
| 230 | + - Parameter title: Menu title |
| 231 | + - Parameter index: Index should be smaller than your menu counts |
| 232 | + */ |
| 233 | + open func changeMenu(title: String, status: YNStatus, at index: Int) { |
| 234 | + switch status { |
| 235 | + case .normal: |
| 236 | + dropDownButtons?[index].buttonLabel.text = title |
| 237 | + dropDownButtons?[index].buttonLabel.textColor = self.buttonlabelFontColors?.normal |
| 238 | + dropDownButtons?[index].buttonLabel.font = self.buttonlabelFonts?.normal |
| 239 | + dropDownButtons?[index].isUserInteractionEnabled = true |
217 | 240 |
|
| 241 | + case .selected: |
| 242 | + dropDownButtons?[index].buttonLabel.text = title |
| 243 | + dropDownButtons?[index].buttonLabel.textColor = self.buttonlabelFontColors?.selected |
| 244 | + dropDownButtons?[index].buttonLabel.font = self.buttonlabelFonts?.selected |
| 245 | + dropDownButtons?[index].isUserInteractionEnabled = true |
| 246 | + |
| 247 | + case .disabled: |
| 248 | + dropDownButtons?[index].buttonLabel.text = title |
| 249 | + dropDownButtons?[index].buttonLabel.textColor = self.buttonlabelFontColors?.disabled |
| 250 | + dropDownButtons?[index].buttonLabel.font = self.buttonlabelFonts?.disabled |
| 251 | + dropDownButtons?[index].isUserInteractionEnabled = false |
| 252 | + } |
218 | 253 | } |
| 254 | + |
219 | 255 |
|
220 | 256 | /** |
221 | 257 | Change view you called. you can call it in YNDropDownMenu or YNDropDownView |
222 | 258 |
|
| 259 | + - Parameter view: view that you want to change |
223 | 260 | - Parameter index: Index should be smaller than your menu counts |
224 | 261 | */ |
225 | 262 | open func changeView(view: UIView, at index: Int) { |
|
0 commit comments