WFCUSelectedUserCollectionViewCell.m 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. //
  2. // SelectedUserCollectionViewCell.m
  3. // WFChatUIKit
  4. //
  5. // Created by Zack Zhang on 2020/4/4.
  6. // Copyright © 2020 Tom Lee. All rights reserved.
  7. //
  8. #import "WFCUSelectedUserCollectionViewCell.h"
  9. #import <SDWebImage/SDWebImage.h>
  10. @implementation WFCUSelectedUserCollectionViewCell
  11. - (instancetype)initWithFrame:(CGRect)frame {
  12. self = [super initWithFrame:frame];
  13. if (self) {
  14. [self.contentView addSubview:self.imgV];
  15. }
  16. return self;
  17. }
  18. - (void)setUser:(WFCUSelectedUserInfo *)user {
  19. [self.imgV sd_setImageWithURL:[NSURL URLWithString:[user.portrait stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]] placeholderImage: [UIImage imageNamed:@"PersonalChat"]];
  20. }
  21. - (void)setIsSmall:(BOOL)isSmall {
  22. if (isSmall) {
  23. self.imgV.layer.cornerRadius = 4;
  24. }
  25. }
  26. - (void)layoutSubviews {
  27. [super layoutSubviews];
  28. self.imgV.frame = self.bounds;
  29. }
  30. - (UIImageView *)imgV {
  31. if (!_imgV) {
  32. _imgV = [UIImageView new];
  33. _imgV.layer.cornerRadius = 8;
  34. _imgV.layer.masksToBounds = YES;
  35. }
  36. return _imgV;
  37. }
  38. @end