
- Removed YuMi/Library/ (138 MB, not tracked) - Removed YuMi/Resources/ (23 MB, not tracked) - Removed old version assets (566 files, not tracked) - Excluded Pods/, xcuserdata/ and other build artifacts - Clean repository optimized for company server deployment
63 lines
1.5 KiB
Objective-C
63 lines
1.5 KiB
Objective-C
//
|
|
// MSBaseTextField.m
|
|
// YuMi
|
|
//
|
|
// Created by duoban on 2024/4/15.
|
|
//
|
|
#import <ReactiveObjC.h>
|
|
#import "MSBaseTextField.h"
|
|
@interface MSBaseTextField()
|
|
@property(nonatomic,strong)UILabel *textView;
|
|
@end
|
|
@implementation MSBaseTextField
|
|
-(instancetype)initWithFrame:(CGRect)frame{
|
|
self = [super initWithFrame:frame];
|
|
if(self){
|
|
[self installUI];
|
|
[self installConstraints];
|
|
}
|
|
return self;
|
|
}
|
|
-(void)installUI{
|
|
|
|
[self addSubview:self.textView];
|
|
[self.textView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.centerY.equalTo(self);
|
|
make.leading.equalTo(self).inset(kGetScaleWidth(5));
|
|
}];
|
|
//使用RAC来监听字符串myString的变化
|
|
@kWeakify(self);
|
|
[RACObserve(self, text) subscribeNext:^(id _Nullable x) {
|
|
@kStrongify(self)
|
|
|
|
NSString *text = [NSString stringWithFormat:@"%@",x];
|
|
self.textView.hidden = text.length > 0;
|
|
}];
|
|
[self addTarget:self action:@selector(ms_textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
|
|
}
|
|
-(void)installConstraints{
|
|
|
|
}
|
|
|
|
#pragma mark - 懒加载
|
|
-(instancetype)init{
|
|
self = [super init];
|
|
if(self){
|
|
[self installUI];
|
|
}
|
|
return self;
|
|
}
|
|
-(void)ms_textFieldDidChange:(UITextField *)textField{
|
|
self.textView.hidden = textField.text.length > 0;
|
|
}
|
|
-(void)setAttributedPlaceholder:(NSAttributedString *)attributedPlaceholder{
|
|
_textView.attributedText = attributedPlaceholder;
|
|
}
|
|
- (UILabel *)textView{
|
|
if(!_textView){
|
|
_textView = [UILabel new];
|
|
}
|
|
return _textView;
|
|
}
|
|
@end
|