12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- //
- // YMImproveInfoInviteCodeView.m
- // MSYOUPAI
- //
- // Created by YoMi on 2024/2/8.
- // Copyright © 2024 MS. All rights reserved.
- //
- #import "YMImproveInfoInviteCodeView.h"
- #import "YMImproveInfoViewModel.h"
- @interface YMImproveInfoInviteCodeView ()
- /// 完善信息VM
- @property (nonatomic, strong) YMImproveInfoViewModel *viewModel;
- /// 邀请码标题标签
- @property (nonatomic, strong) UILabel *inviteCodeTitleLb;
- @end
- @implementation YMImproveInfoInviteCodeView
- - (void)ym_setupViews{
- [self addSubview:self.inviteCodeTitleLb];
- [self addSubview:self.inviteCodeContentInputBox];
-
- [self setNeedsUpdateConstraints];
- [self updateConstraintsIfNeeded];
- }
- - (void)updateConstraints{
-
- [self.inviteCodeTitleLb mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self).offset(adapt(10));
- make.left.equalTo(self).offset(adapt(20));
- make.bottom.equalTo(self).offset(adapt(-10));
- make.height.mas_equalTo(adapt(25));
- }];
-
- [self.inviteCodeContentInputBox mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.inviteCodeTitleLb.mas_top);
- make.right.equalTo(self).offset(adapt(-20));
- make.bottom.equalTo(self.inviteCodeTitleLb.mas_bottom);
- make.width.mas_equalTo(adapt(200));
- }];
-
- [super updateConstraints];
- }
- - (void)ym_bindViewModel:(YMImproveInfoViewModel *)viewModel{
- if (!viewModel) {
- return;
- }
-
- _viewModel = viewModel;
-
- }
- - (UILabel *)inviteCodeTitleLb{
- if (!_inviteCodeTitleLb) {
- _inviteCodeTitleLb = [[UILabel alloc]init];
- _inviteCodeTitleLb.font = LCFont(16);
- _inviteCodeTitleLb.textColor = HexColorFromRGB(0x1B2739);
- _inviteCodeTitleLb.textAlignment = NSTextAlignmentLeft;
- _inviteCodeTitleLb.text = @"邀请码";
- }
- return _inviteCodeTitleLb;
- }
- - (UITextField *)inviteCodeContentInputBox{
- if (!_inviteCodeContentInputBox) {
- NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc]init];
- style.minimumLineHeight = 0;
- NSMutableAttributedString *placeholderAttributed = [[NSMutableAttributedString alloc]initWithString:@"请输入邀请码(选填)"];
- placeholderAttributed.yy_paragraphStyle = style;
- placeholderAttributed.yy_font = LCFont(16);
- placeholderAttributed.yy_color = HexColorFromRGB(0xADB0BC);
- placeholderAttributed.yy_alignment = NSTextAlignmentRight;
- _inviteCodeContentInputBox = [[UITextField alloc]init];
- _inviteCodeContentInputBox.textAlignment = NSTextAlignmentRight;
- _inviteCodeContentInputBox.attributedPlaceholder = placeholderAttributed;
- _inviteCodeContentInputBox.clearButtonMode = UITextFieldViewModeWhileEditing;
- _inviteCodeContentInputBox.autocorrectionType = UITextAutocorrectionTypeDefault;
- _inviteCodeContentInputBox.autocapitalizationType = UITextAutocapitalizationTypeNone;
- _inviteCodeContentInputBox.keyboardType = UIKeyboardTypeDefault;
- @weakify(self)
- [[[_inviteCodeContentInputBox rac_textSignal] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(id x) {
- @strongify(self)
-
- }];
- }
- return _inviteCodeContentInputBox;
- }
- @end
|