2
0

ChatroomItemCell.m 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. //
  2. // ChatroomItemCell.m
  3. // WildFireChat
  4. //
  5. // Created by heavyrain lee on 2018/8/24.
  6. // Copyright © 2018 WildFireChat. All rights reserved.
  7. //
  8. #import "ChatroomItemCell.h"
  9. #import <SDWebImage/SDWebImage.h>
  10. @implementation ChatroomItemCell
  11. - (void)setChatroomInfo:(WFCCChatroomInfo *)chatroomInfo {
  12. _chatroomInfo = chatroomInfo;
  13. if (_chatroomInfo.portrait) {
  14. [self.portraitIV sd_setImageWithURL:[NSURL URLWithString:_chatroomInfo.portrait] placeholderImage:[UIImage imageNamed:@"GroupChatRound"]];
  15. } else {
  16. [self.portraitIV setImage:[UIImage imageNamed:@"GroupChatRound"]];
  17. }
  18. self.titleLable.text = _chatroomInfo.title;
  19. }
  20. - (UIImageView *)portraitIV {
  21. if (!_portraitIV) {
  22. _portraitIV = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.width)];
  23. _portraitIV.layer.masksToBounds = YES;
  24. _portraitIV.layer.cornerRadius = self.bounds.size.width/2;
  25. [self addSubview:_portraitIV];
  26. }
  27. return _portraitIV;
  28. }
  29. - (UILabel *)titleLable {
  30. if (!_titleLable) {
  31. _titleLable = [[UILabel alloc] initWithFrame:CGRectMake(0, self.bounds.size.width, self.bounds.size.width, self.bounds.size.height - self.bounds.size.width)];
  32. [_titleLable setTextAlignment:NSTextAlignmentCenter];
  33. [self addSubview:_titleLable];
  34. }
  35. return _titleLable;
  36. }
  37. @end