CalendarStoreTableViewCell.swift 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. //
  2. // CalendarStoreTableViewCell.swift
  3. // O2Platform
  4. //
  5. // Created by FancyLou on 2020/9/22.
  6. // Copyright © 2020 zoneland. All rights reserved.
  7. //
  8. import UIKit
  9. protocol CalendarStoreCellFollowDelegate {
  10. func follow(calendar: OOCalendarInfo?)
  11. }
  12. class CalendarStoreTableViewCell: UITableViewCell {
  13. @IBOutlet weak var calendarColorView: UIView!
  14. @IBOutlet weak var calendarTitleLable: UILabel!
  15. @IBOutlet weak var calendarOwnerLabel: UILabel!
  16. @IBOutlet weak var calendarFllowBtn: UIButton!
  17. @IBAction func tapFollowBtn(_ sender: UIButton) {
  18. self.delegate?.follow(calendar: self.info)
  19. }
  20. var delegate: CalendarStoreCellFollowDelegate?
  21. private var info: OOCalendarInfo?
  22. override func awakeFromNib() {
  23. super.awakeFromNib()
  24. }
  25. override func setSelected(_ selected: Bool, animated: Bool) {
  26. super.setSelected(selected, animated: animated)
  27. }
  28. func setOOCalendarInfo(calendar: OOCalendarInfo) {
  29. self.info = calendar
  30. if let color = calendar.color {
  31. self.calendarColorView.backgroundColor = UIColor.init(hex: color)
  32. }else {
  33. self.calendarColorView.theme_backgroundColor = ThemeColorPicker(keyPath: "Base.base_color")
  34. }
  35. self.calendarTitleLable.text = calendar.name ?? ""
  36. self.calendarOwnerLabel.text = "创建人: \(calendar.createor?.getChinaName() ?? "")"
  37. if calendar.followed == true {
  38. self.calendarFllowBtn.setTitle("已关注", for: .normal)
  39. self.calendarFllowBtn.setTitleColor(toolbar_text_color, for: .normal)
  40. }else {
  41. self.calendarFllowBtn.setTitle("关注", for: .normal)
  42. self.calendarFllowBtn.setTitleColor(base_color, for: .normal)
  43. }
  44. }
  45. }