// // TableDefaultCell.m // model // // Created by JuYi on 2018/7/16. // Copyright © 2018年 Mine. All rights reserved. // 标题 + 内容 cell #import "TableDefaultCell.h" #import @implementation TableDefaultCell - (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 - 121, cellHeight); contentTF.textAlignment = NSTextAlignmentLeft; contentTF.font = [UIFont systemFontOfSize:16]; contentTF.textColor = RGBValueColor(0x333333, 1.0); Ivar ivar = class_getInstanceVariable([UITextField class], "_placeholderLabel"); UILabel *placeholderLabel = object_getIvar(contentTF, ivar); placeholderLabel.textColor = RGBValueColor(0x999999, 1.0); contentTF.clearButtonMode = UITextFieldViewModeWhileEditing; [self.contentView addSubview:contentTF]; self.contentTF = contentTF; // self.lineView = [[UIImageView alloc] initWithFrame:CGRectMake(0, cellHeight - 1, ScreenWidth, 1)]; self.lineView.image = [UIImage imageNamed:@"fengexian"]; [self.contentView addSubview:self.lineView]; } @end