萤石云 iOSSDK,移植跨平台相关工程
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//
//  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