TableDefaultCell.m 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //
  2. // TableDefaultCell.m
  3. // model
  4. //
  5. // Created by JuYi on 2018/7/16.
  6. // Copyright © 2018年 Mine. All rights reserved.
  7. // 标题 + 内容 cell
  8. #import "TableDefaultCell.h"
  9. @implementation TableDefaultCell
  10. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
  11. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  12. if (self) {
  13. self.selectionStyle = UITableViewCellSelectionStyleNone;
  14. self.backgroundColor = [UIColor whiteColor];
  15. [self setUpSubViewsForCell];
  16. }
  17. return self;
  18. }
  19. - (void)setUpSubViewsForCell {
  20. CGFloat cellHeight = 50;
  21. UILabel *titleLabel = [[UILabel alloc] init];
  22. titleLabel.frame = CGRectMake(20, 0, 80, cellHeight);
  23. titleLabel.textAlignment = NSTextAlignmentLeft;
  24. titleLabel.font = [UIFont systemFontOfSize:16];
  25. titleLabel.textColor = RGBValueColor(0x333333, 1.0);
  26. [self.contentView addSubview:titleLabel];
  27. self.titleLabel = titleLabel;
  28. //
  29. UITextField *contentTF = [[UITextField alloc] init];
  30. contentTF.frame = CGRectMake(CGRectGetMaxX(titleLabel.frame), 0, ScreenWidth - 121, cellHeight);
  31. contentTF.textAlignment = NSTextAlignmentLeft;
  32. contentTF.font = [UIFont systemFontOfSize:16];
  33. contentTF.textColor = RGBValueColor(0x333333, 1.0);
  34. [contentTF setValue:RGBValueColor(0x999999, 1.0) forKeyPath:@"_placeholderLabel.textColor"];
  35. contentTF.clearButtonMode = UITextFieldViewModeWhileEditing;
  36. [self.contentView addSubview:contentTF];
  37. self.contentTF = contentTF;
  38. //
  39. self.lineView = [[UIImageView alloc] initWithFrame:CGRectMake(0, cellHeight - 1, ScreenWidth, 1)];
  40. self.lineView.image = [UIImage imageNamed:@"fengexian"];
  41. [self.contentView addSubview:self.lineView];
  42. }
  43. @end