WFCMeTableViewHeaderViewCell.m 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. //
  2. // MeTableViewCell.m
  3. // WildFireChat
  4. //
  5. // Created by WF Chat on 2018/10/2.
  6. // Copyright © 2018 WildFireChat. All rights reserved.
  7. //
  8. #import "WFCMeTableViewHeaderViewCell.h"
  9. #import <SDWebImage/SDWebImage.h>
  10. #import "UIFont+YH.h"
  11. #import "UIColor+YH.h"
  12. #import <WFChatUIKit/WFChatUIKit.h>
  13. @interface WFCMeTableViewHeaderViewCell ()
  14. @property (strong, nonatomic) UIImageView *portrait;
  15. @property (strong, nonatomic) UILabel *displayName;
  16. @property (strong, nonatomic) UILabel *userName;
  17. @end
  18. @implementation WFCMeTableViewHeaderViewCell
  19. - (void)awakeFromNib {
  20. [super awakeFromNib];
  21. // Initialization code
  22. }
  23. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  24. [super setSelected:selected animated:animated];
  25. }
  26. - (UIImageView *)portrait {
  27. if (!_portrait) {
  28. _portrait = [[UIImageView alloc] initWithFrame:CGRectMake(16, 64, 60, 60)];
  29. _portrait.layer.cornerRadius = 10.0;
  30. _portrait.layer.masksToBounds = YES;
  31. [self.contentView addSubview:_portrait];
  32. }
  33. return _portrait;
  34. }
  35. - (UILabel *)displayName {
  36. if (!_displayName) {
  37. _displayName = [[UILabel alloc] initWithFrame:CGRectMake(16 + 60 + 20, 64, [UIScreen mainScreen].bounds.size.width - 64, 32)];
  38. [_displayName setFont:[UIFont pingFangSCWithWeight:FontWeightStyleSemibold size:20]];
  39. _displayName.textColor = [WFCUConfigManager globalManager].naviTextColor;
  40. [self.contentView addSubview:_displayName];
  41. }
  42. return _displayName;
  43. }
  44. - (UILabel *)userName {
  45. if (!_userName) {
  46. _userName = [[UILabel alloc] initWithFrame:CGRectMake(16 + 60 + 20, 64 + 32 + 8, [UIScreen mainScreen].bounds.size.width - 128, 14)];
  47. [_userName setFont:[UIFont systemFontOfSize:14]];
  48. _userName.textColor = [WFCUConfigManager globalManager].naviTextColor;
  49. [self.contentView addSubview:_userName];
  50. }
  51. return _userName;
  52. }
  53. - (void)setUserInfo:(WFCCUserInfo *)userInfo {
  54. _userInfo = userInfo;
  55. [self.portrait sd_setImageWithURL:[NSURL URLWithString:self.userInfo.portrait] placeholderImage: [UIImage imageNamed:@"PersonalChat"]];
  56. self.displayName.text = self.userInfo.displayName;
  57. self.userName.text = [NSString stringWithFormat:@"野火ID:%@", self.userInfo.name];
  58. }
  59. @end