123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- //
- // TheoryTrainVC.m
- // jiaPei
- //
- // Created by EchoShacolee on 2018/6/7.
- // Copyright © 2018年 JCZ. All rights reserved.
- //
- //活体检测
- //活体检测
- //活体检测
- //活体检测
- //活体检测
- #import "TheoryTrainVC.h"
- #import <WebKit/WebKit.h>
- #import <AFNetworking.h>
- //#import <MGLivenessDetection/MGLivenessDetection.h>//活体检测
- @interface TheoryTrainVC ()<WKNavigationDelegate>
- @property (weak, nonatomic) IBOutlet WKWebView *webView;
- @end
- @implementation TheoryTrainVC
- - (void)dealloc
- {
- [self.webView removeObserver:self forKeyPath:@"title"];
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
-
- self.webView.navigationDelegate = self;
-
- _file = @"http://124.133.246.162:18080/jpv2H5_2/index.html#/h5/login?account=370021199812212931&pwd=123456";
- // [self myInit];
-
- // if (![MGLiveManager getLicense]) {
- // [MGLiveManager licenseForNetWokrFinish:^(bool License) {
- // NSLog(@"%@", [NSString stringWithFormat:@"%@ %@", NSLocalizedString(@"title_license", nil), License ? NSLocalizedString(@"title_success", nil) : NSLocalizedString(@"title_failure", nil)]);
- // }];
- // }
- // [self startDetect:nil];
-
-
- }
- -(void)myInit
- {
- [self configNavigationBar];
- [self.view setBackgroundColor:[UIColor whiteColor]];
-
- WKWebView *view = [[WKWebView alloc] initWithFrame:kFrame];
- view.height = kSize.height - kNavOffSet;
- view.navigationDelegate = self;
- [self.view addSubview: view];
-
- NSURLRequest *request = nil;
- request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:_file]];
- NSLog(@"%@",request);
-
- [view loadRequest:request];
-
- //监听导航栏标题
- [self.webView addObserver:self forKeyPath:@"title"options:NSKeyValueObservingOptionNew context:NULL];
- }
- - (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning];
- // Dispose of any resources that can be recreated.
- }
- #pragma mark -
- // 页面加载失败时调用
- - (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(null_unspecified WKNavigation *)navigation withError:(NSError *)error{
-
- [MBProgressHUD hideHUDForView:self.view];
- }
- // 页面加载完毕时调用
- - (void)webView:(WKWebView *)webView didFinishNavigation:(null_unspecified WKNavigation *)navigation{
-
- [MBProgressHUD hideHUDForView:self.view];
- }
- ////@lee 这个写到一半
- //-(void)observeValueForKeyPath:(nullableNSString*)keyPathofObject:(nullableid)objectchange:(nullableNSDictionary*)changecontext:(nullablevoid*)context
- //{
- // if([keyPath isEqualToString:@"title"]){
- // self.navigationItem.title=self.webView.title;
- // }
- //}
- #pragma mark - StartDetect
- //- (void)startDetect:(UIButton *)sender {//@lee-mark
- // if (![MGLiveManager getLicense]) {
- // UIAlertController* alertC = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"title_remind", nil)
- // message:NSLocalizedString(@"key_sdk_license_failure", nil)
- // preferredStyle:UIAlertControllerStyleAlert];
- // UIAlertAction* cancelAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"title_sure", nil)
- // style:UIAlertActionStyleCancel
- // handler:nil];
- // [alertC addAction:cancelAction];
- // [self presentViewController:alertC
- // animated:YES
- // completion:nil];
- // return;
- // }
- //
- // sender.userInteractionEnabled = NO;
- // // [self.resultImageV setImage:nil];
- // // [self.messageLabel setText:nil];
- //
- // MGLiveManager *liveManager = [[MGLiveManager alloc] init];
- // liveManager.actionCount = 3;//self.countSeg.selectedSegmentIndex + 1;
- // liveManager.actionTimeOut = 10;//(int)self.timeoutStepper.value;
- // liveManager.randomAction = YES;//self.randomSwitch.isOn;
- // // if (!self.randomSwitch.isOn) {
- // // NSMutableArray* actionMutableArray = [[NSMutableArray alloc] initWithCapacity:liveManager.actionCount];
- // // for (int i = 1; i <= liveManager.actionCount; i++) {
- // // [actionMutableArray addObject:[NSNumber numberWithInt:i]];
- // // }
- // // liveManager.actionArray = (NSArray *)actionMutableArray;
- // // }
- // [liveManager startFaceDecetionViewController:self
- // finish:^(FaceIDData *finishDic, UIViewController *viewController) {
- // sender.userInteractionEnabled = YES;
- // [viewController dismissViewControllerAnimated:YES completion:nil];
- // NSData *resultData = [[finishDic images] valueForKey:@"image_best"];
- // UIImage *resultImage = [UIImage imageWithData:resultData];
- // // [self.resultImageV setImage:resultImage];
- // // [self.messageLabel setText:[NSString stringWithFormat:@"%@ %@", NSLocalizedString(@"key_action_live_detect", nil), NSLocalizedString(@"title_success", nil)]];
- // // [self.messageLabel setTextColor:[UIColor blueColor]];
- // }
- // error:^(MGLivenessDetectionFailedType errorType, UIViewController *viewController) {
- // sender.userInteractionEnabled = YES;
- // [viewController dismissViewControllerAnimated:YES completion:nil];
- // // [self showErrorString:errorType];
- // // [self.messageLabel setTextColor:[UIColor redColor]];
- // }];
- //
- //
- //}
- //
- //
- //
- ///*
- //#pragma mark - Navigation
- //
- // In a storyboard-based application, you will often want to do a little preparation before navigation
- //- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
- // Get the new view controller using [segue destinationViewController].
- // Pass the selected object to the new view controller.
- //}
- //*/
- @end
|