WFCFavoriteLocationCell.m 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. //
  2. // WFCFavoriteUnknownCell.m
  3. // WildFireChat
  4. //
  5. // Created by Tom Lee on 2020/11/1.
  6. // Copyright © 2020 WildFireChat. All rights reserved.
  7. //
  8. #import "WFCFavoriteLocationCell.h"
  9. #import <WFChatUIKit/WFChatUIKit.h>
  10. @interface WFCFavoriteLocationCell ()
  11. @property(nonatomic, strong)UIImageView *iconView;
  12. @property(nonatomic, strong)UILabel *nameLabel;
  13. @end
  14. @implementation WFCFavoriteLocationCell
  15. - (void)awakeFromNib {
  16. [super awakeFromNib];
  17. // Initialization code
  18. }
  19. - (void)setFavoriteItem:(WFCUFavoriteItem *)favoriteItem {
  20. [super setFavoriteItem:favoriteItem];
  21. [self iconView];
  22. self.nameLabel.text = favoriteItem.title;
  23. }
  24. + (CGFloat)contentHeight:(WFCUFavoriteItem *)favoriteItem {
  25. return 56;
  26. }
  27. - (UIImageView *)iconView {
  28. if (!_iconView) {
  29. _iconView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 56, 56)];
  30. _iconView.image = [UIImage imageNamed:@"location_icon"];
  31. _iconView.backgroundColor = [UIColor colorWithRed:0.9 green:0.9 blue:0.9 alpha:1.f];
  32. [self.contentArea addSubview:_iconView];
  33. }
  34. return _iconView;
  35. }
  36. - (UILabel *)nameLabel {
  37. if (!_nameLabel) {
  38. _nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(64, 8, self.bounds.size.width-72, 20)];
  39. _nameLabel.font = [UIFont systemFontOfSize:18];
  40. [self.contentArea addSubview:_nameLabel];
  41. }
  42. return _nameLabel;
  43. }
  44. @end