// // TableWithVerificationCodeCell.m // model // // Created by JuYi on 2018/7/16. // Copyright © 2018年 Mine. All rights reserved. // 带获取验证码的cell #import "TableWithVerificationCodeCell.h" @implementation TableWithVerificationCodeCell - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { self.selectionStyle = UITableViewCellSelectionStyleNone; self.backgroundColor = [UIColor whiteColor]; [self setUpSubViewsForCell]; } return self; } - (void)setUpSubViewsForCell { CGFloat cellHeight = 50; UILabel *titleLabel = [[UILabel alloc] init]; titleLabel.frame = CGRectMake(20, 0, 80, cellHeight); titleLabel.textAlignment = NSTextAlignmentLeft; titleLabel.font = [UIFont systemFontOfSize:16]; titleLabel.textColor = RGBValueColor(0x333333, 1.0); [self.contentView addSubview:titleLabel]; self.titleLabel = titleLabel; // UITextField *contentTF = [[UITextField alloc] init]; contentTF.frame = CGRectMake(CGRectGetMaxX(titleLabel.frame), 0, ScreenWidth - 200, cellHeight); contentTF.textAlignment = NSTextAlignmentLeft; contentTF.font = [UIFont systemFontOfSize:16]; contentTF.textColor = RGBValueColor(0x333333, 1.0); [contentTF setValue:RGBValueColor(0x999999, 1.0) forKeyPath:@"_placeholderLabel.textColor"]; contentTF.clearButtonMode = UITextFieldViewModeWhileEditing; [self.contentView addSubview:contentTF]; self.contentTF = contentTF; // UIButton *codeBtn = [UIButton buttonWithType:UIButtonTypeCustom]; codeBtn.frame = CGRectMake(ScreenWidth - 120, cellHeight / 2 - 16, 100, 32); codeBtn.backgroundColor = RGBValueColor(0xf7f7f7, 1.0); [codeBtn setTitle:@"获取验证码" forState:UIControlStateNormal]; [codeBtn setTitleColor:RGBValueColor(0xfe4086, 1.0) forState:UIControlStateNormal]; codeBtn.titleLabel.font = [UIFont systemFontOfSize:16.0]; codeBtn.layer.cornerRadius = 16; codeBtn.layer.masksToBounds = YES; [self.contentView addSubview:codeBtn]; self.codeBtn = codeBtn; } @end