ReleaseTopicCell.m 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. //
  2. // ReleaseTopicCell.m
  3. // BuguLive
  4. //
  5. // Created by bugu on 2019/11/28.
  6. // Copyright © 2019 xfg. All rights reserved.
  7. //
  8. #import "ReleaseTopicCell.h"
  9. @implementation ReleaseTopicCell
  10. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
  11. {
  12. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  13. if (self) {
  14. [self initViews];
  15. }
  16. return self;
  17. }
  18. - (void)initViews{
  19. self.topicLabel = [[UILabel alloc]init];
  20. self.topicLabel.textColor = [UIColor colorWithHexString:@"#333333"];
  21. self.topicLabel.font = [UIFont systemFontOfSize:14];
  22. self.numLabel = [[UILabel alloc]init];
  23. self.numLabel.textColor = [UIColor colorWithHexString:@"#666666"];
  24. self.numLabel.font = [UIFont systemFontOfSize:14];
  25. self.topicLabel.text = @"#xxxxxxx#";
  26. self.numLabel.text = @"xxxxxxx";
  27. [self.contentView addSubview: self.topicLabel];
  28. [self.contentView addSubview: self.numLabel];
  29. }
  30. - (void)layoutSubviews {
  31. [super layoutSubviews];
  32. [self.topicLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  33. make.left.mas_equalTo(10);
  34. make.centerY.equalTo(self);
  35. }];
  36. [self.numLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  37. make.right.mas_equalTo(-10);
  38. make.centerY.equalTo(self);
  39. }];
  40. }
  41. - (void)setTopic:(MGDynamicTopicModel *)topic
  42. {
  43. self.topicLabel.text = [NSString stringWithFormat:@"#%@#",topic.name];
  44. self.numLabel.text = [NSString stringWithFormat:ASLocalizedString(@"%@人讨论"),topic.num];
  45. }
  46. @end