SubjectTableViewCell.swift 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. //
  2. // SubjectTableViewCell.swift
  3. // O2Platform
  4. //
  5. // Created by 刘振兴 on 2016/11/4.
  6. // Copyright © 2016年 zoneland. All rights reserved.
  7. //
  8. import UIKit
  9. import SDWebImage
  10. import Alamofire
  11. import ObjectMapper
  12. import CocoaLumberjack
  13. class SubjectTableViewCell: UITableViewCell {
  14. @IBOutlet weak var subjectPersonIconImageView: UIImageView!
  15. @IBOutlet weak var topSubjectImageView: UIImageView!
  16. @IBOutlet weak var subjectTitleLabel: UILabel!
  17. @IBOutlet weak var subjectNameLabel: UILabel!
  18. @IBOutlet weak var subjectPubDateLabel: UILabel!
  19. @IBOutlet weak var subjectViewNumberLabel: UILabel!
  20. @IBOutlet weak var subjectReplyNumberLabel: UILabel!
  21. var bbsSubjectData:BBSSubjectData? {
  22. didSet {
  23. self.topSubjectImageView.isHidden = !(bbsSubjectData?.isTopSubject)!
  24. self.subjectTitleLabel.text = bbsSubjectData?.title
  25. self.subjectNameLabel.text = (bbsSubjectData?.creatorName?.contains("@"))! ? bbsSubjectData?.creatorName?.split("@")[0] : bbsSubjectData?.creatorName
  26. self.subjectPubDateLabel.text = bbsSubjectData?.createTime
  27. self.subjectViewNumberLabel.text = bbsSubjectData?.viewTotal?.toString
  28. self.subjectReplyNumberLabel.text = bbsSubjectData?.replyTotal?.toString
  29. //let urlString = AppDelegate.o2Collect.generateURLWithAppContextKey(ContactContext.contactsContextKey, query: ContactContext.personIconByNameQuery, parameter: ["##name##":bbsSubjectData?.creatorName as AnyObject])
  30. //let url = URL(string: urlString!)
  31. //self.subjectPersonIconImageView.af_setImage(withURL: url!)
  32. let urlstr = AppDelegate.o2Collect.generateURLWithAppContextKey(ContactContext.contactsContextKeyV2, query: ContactContext.personIconByNameQueryV2, parameter: ["##name##":bbsSubjectData?.creatorName as AnyObject], generateTime: false)
  33. let url = URL(string: urlstr!)
  34. self.subjectPersonIconImageView.hnk_setImageFromURL(url!)
  35. }
  36. }
  37. override func awakeFromNib() {
  38. super.awakeFromNib()
  39. //图像变圆形
  40. self.subjectPersonIconImageView.layer.cornerRadius = 20
  41. self.subjectPersonIconImageView.layer.masksToBounds = true
  42. self.subjectPersonIconImageView.clipsToBounds = true
  43. }
  44. override func setSelected(_ selected: Bool, animated: Bool) {
  45. super.setSelected(selected, animated: animated)
  46. // Configure the view for the selected state
  47. }
  48. }