// // HDLEZInputViewController.m // EZSDK // // Created by 陈启扬 on 2023/3/13. // #import "HDLEZInputViewController.h" @interface HDLEZInputViewController () @property(nonatomic,strong)HDLEZInputView *inputView; //输入view @end @implementation HDLEZInputViewController - (void)viewDidLoad { [super viewDidLoad]; //导航栏 [self setTopBarViewWithTitle:self.navTitle]; [self.topBarView.bottomLine setHidden:YES]; //确认按钮 self.topBarView.rightButton.frame = CGRectMake(HDLEZ_APP_SCREEN_WIDTH-16-50, HDLEZ_APP_STATUS_BAR_HEIGHT+(44-20)/2, 50, 20); self.topBarView.rightButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight; self.topBarView.rightBtnTitle=HDLEZLocallizedString(@"device_temp_sure"); [self.topBarView.rightButton addTarget:self action:@selector(sure) forControlEvents:UIControlEventTouchUpInside]; //取消按钮 [self.topBarView.backButton setImage:nil forState:UIControlStateNormal]; self.topBarView.leftBtnTitle=HDLEZLocallizedString(@"device_temp_cancle"); } -(void)addSubViews{ //输入view _inputView=[[HDLEZInputView alloc] init]; [self.view addSubview:_inputView]; [_inputView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.view).offset(HDLEZ_APP_TOP_BAR_HEIGHT); make.left.bottom.right.equalTo(self.view); }]; _inputView.inputType=self.inputType; } /*确认 */ -(void)sure{ if (self.inputType==HDLEZInputType_UseCount) { if (_inputView.inputTextF.text.length!=0&&![HDLEZConstants validateNumber:_inputView.inputTextF.text]) {//输入非纯数字 [self.view makeToast:HDLEZLocallizedString(@"device_temp_input_pure_number") duration:1.5 position:@"center"]; return; } if (_inputView.inputTextF.text.length!=0&&([_inputView.inputTextF.text integerValue]>100||[_inputView.inputTextF.text integerValue]<1)){//输入大于100或小于1 [self.view makeToast:HDLEZLocallizedString(@"device_temp_input_valid_number") duration:1.5 position:@"center"]; return; } } if (self.inputDelegate&&[self.inputDelegate respondsToSelector:@selector(inputContent:inputType:)]) { [self.inputDelegate inputContent:_inputView.inputTextF.text inputType:self.inputType]; } [self dismissViewControllerAnimated:YES completion:nil]; } @end