NewMainItemTableViewCell.swift 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //
  2. // NewMainItemTableViewCell.swift
  3. // O2Platform
  4. //
  5. // Created by 刘振兴 on 2017/3/12.
  6. // Copyright © 2017年 zoneland. All rights reserved.
  7. //
  8. import UIKit
  9. class NewMainItemTableViewCell: UITableViewCell {
  10. @IBOutlet weak var categoryNameLabel: UILabel!
  11. @IBOutlet weak var titleLabel: UILabel!
  12. @IBOutlet weak var timeLabel: UILabel!
  13. var model:NSObject! {
  14. didSet{
  15. if model.isKind(of: CMS_PublishInfo.self){
  16. let m = model as! CMS_PublishInfo
  17. self.categoryNameLabel.text = "【\(m.categoryName!)】"
  18. self.titleLabel.text = m.title
  19. self.timeLabel.text = m.publishTime?.split(separator: " ").first?.description
  20. }else if(model.isKind(of: TodoTask.self)){
  21. let m = model as! TodoTask
  22. self.categoryNameLabel.text = "【\(m.applicationName!)】"
  23. var title = ""
  24. if m.title == nil || m.title?.isEmpty == true {
  25. title = "无标题"
  26. }else {
  27. title = m.title!
  28. }
  29. self.titleLabel.text = title
  30. self.timeLabel.text = m.updateTime?.split(separator:" ").first?.description
  31. }
  32. }
  33. }
  34. override func awakeFromNib() {
  35. super.awakeFromNib()
  36. // Initialization code
  37. }
  38. override func setSelected(_ selected: Bool, animated: Bool) {
  39. super.setSelected(selected, animated: animated)
  40. // Configure the view for the selected state
  41. }
  42. }