You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
109 lines
3.0 KiB
109 lines
3.0 KiB
![]()
2 years ago
|
//
|
||
|
// SOSTableViewCell.m
|
||
|
// LekangGuard
|
||
|
//
|
||
|
// Created by ecell on 2022/12/6.
|
||
|
//
|
||
|
|
||
|
#import "SOSTableViewCell.h"
|
||
|
|
||
|
@interface SOSTableViewCell ()
|
||
|
|
||
|
/// 标题
|
||
|
@property (nonatomic ,weak) UILabel *titleLabel;
|
||
|
|
||
|
|
||
|
@property (nonatomic ,weak) UITextField *sosField;
|
||
|
|
||
|
@end
|
||
|
|
||
|
@implementation SOSTableViewCell
|
||
|
|
||
|
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
|
||
|
{
|
||
|
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
|
||
|
if (self)
|
||
|
{
|
||
|
//self.selectionStyle = UITableViewCellSelectionStyleNone;
|
||
|
self.backgroundColor = KKWhiteColorColor;
|
||
|
[self subCellView];
|
||
|
}
|
||
|
|
||
|
return self;
|
||
|
}
|
||
|
|
||
|
- (void)setRows:(NSInteger)rows
|
||
|
{
|
||
|
_rows = rows;
|
||
|
}
|
||
|
|
||
|
- (void)setTitleStr:(NSString *)titleStr
|
||
|
{
|
||
|
_titleStr = titleStr;
|
||
|
self.titleLabel.text = titleStr;
|
||
|
}
|
||
|
|
||
|
- (void)setSosText:(NSString *)sosText
|
||
|
{
|
||
|
_sosText = sosText;
|
||
|
self.sosField.text = sosText;
|
||
|
}
|
||
|
|
||
|
- (void)subCellView
|
||
|
{
|
||
|
UILabel *titleLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontADA_(14) textColor:KKTextBlackColor text:@"" Radius:0];
|
||
|
self.titleLabel = titleLabel;
|
||
|
[self.contentView addSubview:titleLabel];
|
||
|
[titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
|
make.left.equalTo(self.contentView).offset(15);
|
||
|
make.centerY.equalTo(self.contentView);
|
||
|
}];
|
||
|
|
||
|
UITextField *textfield = [UICommon ui_textField:CGRectZero textColor:KKTextBlackColor backColor:KKClearColor font:FontADA_(14) maxTextNum:13 placeholderColor:KKGrey143 placeholder:GJText(@"请输入SOS号码") toMaxNum:^(UITextField *textField) {
|
||
|
|
||
|
} change:^(UITextField *textField) {
|
||
|
|
||
|
}];
|
||
|
textfield.keyboardType = UIKeyboardTypePhonePad;
|
||
|
[textfield addTarget:self action:@selector(cellClick:) forControlEvents:UIControlEventEditingChanged];
|
||
|
self.sosField = textfield;
|
||
|
[self.contentView addSubview:textfield];
|
||
|
[textfield mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
|
make.right.equalTo(self.contentView.mas_right).inset(15);
|
||
|
make.left.equalTo(self.contentView).offset(Adapted(110));
|
||
|
make.centerY.equalTo(self.contentView);
|
||
|
make.height.mas_equalTo(Adapted(44));
|
||
|
}];
|
||
|
}
|
||
|
|
||
|
- (void)cellClick:(UITextField *)sender
|
||
|
{
|
||
|
if ([sender isKindOfClass:[UITextField class]])
|
||
|
{
|
||
|
UITextField *textField = sender;
|
||
|
if (textField.keyboardType == UIKeyboardTypePhonePad) {
|
||
|
NSString *tmp = textField.text;
|
||
|
|
||
|
NSCharacterSet *cs = [[NSCharacterSet characterSetWithCharactersInString:@"0123456789-"] invertedSet];
|
||
|
textField.text = [[tmp componentsSeparatedByCharactersInSet:cs] componentsJoinedByString:@""];
|
||
|
}
|
||
|
self.isInputMsg(self.rows, textField.text);
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
- (void)awakeFromNib {
|
||
|
[super awakeFromNib];
|
||
|
// Initialization code
|
||
|
}
|
||
|
|
||
|
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
||
|
[super setSelected:selected animated:animated];
|
||
|
|
||
|
// Configure the view for the selected state
|
||
|
}
|
||
|
|
||
|
@end
|