TableWithVerificationCodeCell.m 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. //
  2. // TableWithVerificationCodeCell.m
  3. // model
  4. //
  5. // Created by JuYi on 2018/7/16.
  6. // Copyright © 2018年 Mine. All rights reserved.
  7. // 带获取验证码的cell
  8. #import "TableWithVerificationCodeCell.h"
  9. @implementation TableWithVerificationCodeCell
  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 - 200, 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. UIButton *codeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  40. codeBtn.frame = CGRectMake(ScreenWidth - 120, cellHeight / 2 - 16, 100, 32);
  41. codeBtn.backgroundColor = RGBValueColor(0xf7f7f7, 1.0);
  42. [codeBtn setTitle:@"获取验证码" forState:UIControlStateNormal];
  43. [codeBtn setTitleColor:RGBValueColor(0xfe4086, 1.0) forState:UIControlStateNormal];
  44. codeBtn.titleLabel.font = [UIFont systemFontOfSize:16.0];
  45. codeBtn.layer.cornerRadius = 16;
  46. codeBtn.layer.masksToBounds = YES;
  47. [self.contentView addSubview:codeBtn];
  48. self.codeBtn = codeBtn;
  49. }
  50. @end