OOContactPersonCell.swift 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. //
  2. // OOContactPersonCell.swift
  3. // O2Platform
  4. //
  5. // Created by 刘振兴 on 2018/4/24.
  6. // Copyright © 2018年 zoneland. All rights reserved.
  7. //
  8. import UIKit
  9. import SDWebImage
  10. class OOContactPersonCell: UITableViewCell,Configurable {
  11. @IBOutlet weak var iconImageView: UIImageView!
  12. @IBOutlet weak var nameLabel: UILabel!
  13. @IBOutlet weak var mobileLabel: UILabel!
  14. var viewModel:OOPersonListViewModel?
  15. override func awakeFromNib() {
  16. super.awakeFromNib()
  17. self.iconImageView.layer.masksToBounds = true
  18. self.iconImageView.layer.cornerRadius = 20
  19. }
  20. override func setSelected(_ selected: Bool, animated: Bool) {
  21. super.setSelected(selected, animated: animated)
  22. // Configure the view for the selected state
  23. }
  24. func config(withItem item: Any?) {
  25. guard let person = item as? OOPersonModel else {
  26. return
  27. }
  28. self.nameLabel.text = person.name
  29. self.mobileLabel.text = person.mobile
  30. viewModel?.getIconOfPerson(person, compeletionBlock: { (iconImage, errMsg) in
  31. if errMsg == nil {
  32. self.iconImageView.image = iconImage
  33. }else{
  34. print(errMsg)
  35. }
  36. })
  37. }
  38. }