酷店

MSSAutoresizeLabelFlowCell.m 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //
  2. // MSSAutoresizeLabelFlowCell.m
  3. // MSSAutoresizeLabelFlow
  4. //
  5. // Created by Mrss on 15/12/26.
  6. // Copyright © 2015年 expai. All rights reserved.
  7. //
  8. #import "MSSAutoresizeLabelFlowCell.h"
  9. #import "MSSAutoresizeLabelFlowConfig.h"
  10. #define JKColor(r, g, b, a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:(a)]
  11. @interface MSSAutoresizeLabelFlowCell ()
  12. @property (nonatomic,strong) UILabel *titleLabel;
  13. @end
  14. @implementation MSSAutoresizeLabelFlowCell
  15. - (UILabel *)titleLabel {
  16. if (_titleLabel == nil) {
  17. _titleLabel = [[UILabel alloc]init];
  18. _titleLabel.backgroundColor = [UIColor colorWithHex:0xF5F4F4];
  19. _titleLabel.textColor = [UIColor colorWithHex:0x808080];
  20. _titleLabel.font = [UIFont systemFontOfSize:13];
  21. _titleLabel.layer.cornerRadius = 3;
  22. _titleLabel.layer.masksToBounds = YES;
  23. _titleLabel.textAlignment = NSTextAlignmentCenter;
  24. }
  25. return _titleLabel;
  26. }
  27. - (instancetype)initWithFrame:(CGRect)frame {
  28. self = [super initWithFrame:frame];
  29. if (self) {
  30. self.backgroundColor=[UIColor colorWithHex:0xF5F4F4];
  31. self.layer.cornerRadius=3;
  32. self.layer.masksToBounds=YES;
  33. [self.contentView addSubview:self.titleLabel];
  34. }
  35. return self;
  36. }
  37. - (void)configCellWithTitle:(NSString *)title {
  38. self.titleLabel.frame = self.bounds;
  39. self.titleLabel.text = title;
  40. }
  41. @end