萤石云 iOSSDK,移植跨平台相关工程
JLChen
2021-02-02 9100afbe1805413504840e6957097be638579045
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
//
//  UIAlertController+TextField.m
//  EZPlaySDKDemo
//
//  Created by yuqian on 2018/10/22.
//  Copyright © 2018 yuqian. All rights reserved.
//
 
#import "UIAlertController+TextField.h"
 
 
@implementation UIAlertController (TextField)
 
+ (UIAlertController *) showAlertVC:(NSString*)deviceSerial confirmHandler:(void(^)(NSString *code))handler {
    
    UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"视频流已加密,请输入密码" message:@"" preferredStyle:UIAlertControllerStyleAlert];
    UIAlertAction *confirmAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        
        NSString *pwd = alertVC.textFields.firstObject.text;
        if (pwd.length >= 6) {
            
            [[GlobalKit shareKit].deviceVerifyCodeBySerial setValue:pwd forKey:deviceSerial];
        }
        
        if (handler) {
            handler(pwd);
        }
    }];
    UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
        
    }];
    [alertVC addAction:confirmAction];
    [alertVC addAction:cancelAction];
    [alertVC addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
        
        textField.placeholder = @"请输入密码";
    }];
    
    return alertVC;
}
 
@end