SettingHomeCell.swift 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. //
  2. // SettingHomeCell.swift
  3. // O2Platform
  4. //
  5. // Created by 刘振兴 on 16/7/6.
  6. // Copyright © 2016年 zoneland. All rights reserved.
  7. //
  8. import UIKit
  9. class SettingHomeCell: UITableViewCell {
  10. @IBOutlet weak var avatarImageView: UIImageView!
  11. @IBOutlet weak var personNameLabel: UILabel!
  12. @IBOutlet weak var personSignLabel: UILabel!
  13. @IBOutlet weak var iconImageView: UIImageView!
  14. @IBOutlet weak var titleLabel: UILabel!
  15. @IBOutlet weak var statusLabel: UILabel!
  16. @IBOutlet weak var bottomLineView: UIView!
  17. //
  18. // var cellModel:SettingHomeCellModel?{
  19. // didSet {
  20. // //设置
  21. // self.iconImageView.image = UIImage(named: (cellModel?.iconName)!)
  22. // self.titleLabel.text = cellModel?.title
  23. //
  24. // if let text = cellModel?.status {
  25. // self.statusLabel.text = text
  26. // }else{
  27. // self.statusLabel.text = ""
  28. // }
  29. // }
  30. // }
  31. override var frame: CGRect {
  32. didSet {
  33. var newFrame = frame
  34. newFrame.origin.x += 10
  35. newFrame.size.width -= 20
  36. super.frame = newFrame
  37. }
  38. }
  39. func showPersonCell() {
  40. self.iconImageView.isHidden = true
  41. self.titleLabel.isHidden = true
  42. self.statusLabel.isHidden = true
  43. self.bottomLineView.isHidden = true
  44. self.personNameLabel.isHidden = false
  45. self.personSignLabel.isHidden = false
  46. self.avatarImageView.isHidden = false
  47. let me = O2AuthSDK.shared.myInfo()
  48. self.personNameLabel.text = me?.name ?? ""
  49. self.personSignLabel.text = me?.signature ?? ""
  50. let avatarUrlString = AppDelegate.o2Collect.generateURLWithAppContextKey(ContactContext.contactsContextKeyV2, query: ContactContext.personIconByNameQueryV2, parameter: ["##name##":me?.id as AnyObject])
  51. let avatarUrl = URL(string: avatarUrlString!)
  52. self.avatarImageView.hnk_setImageFromURL(avatarUrl!)
  53. }
  54. func setModel(model: SettingHomeCellModel, isShowBottom: Bool) {
  55. self.iconImageView.isHidden = false
  56. self.titleLabel.isHidden = false
  57. self.personNameLabel.isHidden = true
  58. self.personSignLabel.isHidden = true
  59. self.avatarImageView.isHidden = true
  60. //设置
  61. self.iconImageView.image = UIImage(named: (model.iconName)!)
  62. self.titleLabel.text = model.title
  63. if let text = model.status {
  64. self.statusLabel.text = text
  65. }else{
  66. self.statusLabel.text = ""
  67. }
  68. if isShowBottom {
  69. self.bottomLineView.isHidden = false
  70. } else {
  71. self.bottomLineView.isHidden = true
  72. }
  73. }
  74. // override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
  75. // super.init(style: style, reuseIdentifier: reuseIdentifier)
  76. // }
  77. //
  78. // required init?(coder aDecoder: NSCoder) {
  79. // fatalError("init(coder:) has not been implemented")
  80. // }
  81. override func awakeFromNib() {
  82. super.awakeFromNib()
  83. }
  84. override func setSelected(_ selected: Bool, animated: Bool) {
  85. super.setSelected(selected, animated: animated)
  86. // Configure the view for the selected state
  87. }
  88. }