OOFormBaseView.swift 902 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. //
  2. // OOFormBaseView.swift
  3. // o2app
  4. //
  5. // Created by 刘振兴 on 2018/1/26.
  6. // Copyright © 2018年 zone. All rights reserved.
  7. //
  8. import UIKit
  9. protocol OOFormBaseUpdateViewProtocol {
  10. func updateViewModel(_ item:Any)
  11. }
  12. class OOFormBaseView: UIView,OOFormBaseUpdateViewProtocol {
  13. var model:OOFormBaseModel?
  14. private var theDate = Date()
  15. private let format = "yyyy年MM月dd日"
  16. func updateViewModel(_ item: Any) {
  17. }
  18. func showDatePicker(pickerStyle: DateStyle, callBackResult:((_ result:Date) -> Void)?, defaultDate: Date = Date()) {
  19. let datePicker = DatePickerView.datePicker(style: pickerStyle, scrollToDate: defaultDate) { date in
  20. guard let date = date else { return }
  21. if let cr = callBackResult {
  22. cr(date)
  23. }
  24. }
  25. datePicker.show()
  26. }
  27. }