CYActiveTieleTableViewCell.m 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. //
  2. // CYActiveTieleTableViewCell.m
  3. // shiku_im
  4. //
  5. // Created by Ron on 2019/11/14.
  6. // Copyright © 2019 Reese. All rights reserved.
  7. //
  8. #import "CYActiveTieleTableViewCell.h"
  9. @implementation CYActiveTieleTableViewCell
  10. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
  11. if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
  12. UILabel *title = [[UILabel alloc] initWithFrame:CGRectMake( 20, 10, 200, 20)];
  13. title.font = [UIFont systemFontOfSize:16.0];
  14. // [self.contentView addSubview:title];
  15. _title = title;
  16. UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(JX_SCREEN_WIDTH- 40, 13, 20, 20)];
  17. // imageView.layer.cornerRadius = 50 / 2;
  18. imageView.layer.masksToBounds = YES;
  19. [self.contentView addSubview:imageView];
  20. imageView.image = [UIImage imageNamed:@"set_list_next"];
  21. _imageV = imageView;
  22. UILabel *subtitle = [[UILabel alloc] initWithFrame:CGRectMake( imageView.frame.origin.x - 10 - 50, 10, 50, 20)];
  23. subtitle.backgroundColor = [UIColor colorWithRed:31/255.0 green:160/255.0 blue:211/255.0 alpha:1];
  24. subtitle.layer.masksToBounds = YES;
  25. subtitle.layer.cornerRadius = 10;
  26. subtitle.textColor = UIColor.whiteColor;
  27. subtitle.textAlignment = NSTextAlignmentCenter;
  28. subtitle.font = [UIFont systemFontOfSize:16.0];
  29. // [self.contentView addSubview:title];
  30. _subtitle = subtitle;
  31. UIView *lineView2 = [[UIView alloc] initWithFrame:CGRectMake(0, 39.5, JX_SCREEN_WIDTH, .5)];
  32. lineView2.backgroundColor = HEXCOLOR(0xdcdcdc);
  33. [self.contentView addSubview:lineView2];
  34. [self.contentView addSubview:_imageV];
  35. [self.contentView addSubview:_title];
  36. [self.contentView addSubview:_subtitle];
  37. // UILabel *subTitle = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(imageView.frame) + 10, CGRectGetMaxY(title.frame) + 7, JX_SCREEN_WIDTH - 65 - (CGRectGetMaxX(imageView.frame) + 10) - 10, 20)];
  38. // subTitle.font = [UIFont systemFontOfSize:14.0];
  39. // subTitle.textColor = [UIColor lightGrayColor];
  40. // [self.contentView addSubview:subTitle];
  41. // _subTitle = subTitle;
  42. //
  43. // UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(JX_SCREEN_WIDTH - 65, 20, 50, 24)];
  44. // btn.backgroundColor = THEMECOLOR;
  45. // [btn setTitle:@"添加" forState:UIControlStateNormal];
  46. // [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  47. // btn.titleLabel.font = [UIFont systemFontOfSize:15.0];
  48. // btn.layer.cornerRadius = 3.0;
  49. // btn.layer.masksToBounds = YES;
  50. // btn.tag = self.tag;
  51. // [btn addTarget:self action:@selector(onAdd:) forControlEvents:UIControlEventTouchUpInside];
  52. // [self.contentView addSubview:btn];
  53. // _addBtn = btn;
  54. }
  55. return self;
  56. }
  57. - (void)setSubtitleText:(NSString *)subtitleText {
  58. _subtitleText = subtitleText;
  59. // 根据字体得到NSString的尺寸
  60. CGSize size = [subtitleText sizeWithAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:16.0],NSFontAttributeName,nil]];
  61. _subtitle.frame = CGRectMake(_imageV.frame.origin.x - 10 - size.width -10, 10, size.width + 10, 20);
  62. _subtitle.text = subtitleText;
  63. }
  64. - (void)awakeFromNib {
  65. [super awakeFromNib];
  66. // Initialization code
  67. }
  68. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  69. [super setSelected:selected animated:animated];
  70. // Configure the view for the selected state
  71. }
  72. @end