Commit 5e7797c712cdb267a1b10eb74526668514d22db6

Authored by 王军波
1 parent 63ba83ee

图片

LiveVideoCloud/Classes/Sections/LiveSections/Controller/LVCVerifyViewController.m
@@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
8 8
9 #import "LVCVerifyViewController.h" 9 #import "LVCVerifyViewController.h"
10 #import <WebKit/WebKit.h> 10 #import <WebKit/WebKit.h>
  11 +#import "LVCLiveViewController.h"
11 12
12 @interface LVCVerifyViewController ()<WKUIDelegate, WKNavigationDelegate> 13 @interface LVCVerifyViewController ()<WKUIDelegate, WKNavigationDelegate>
13 14
@@ -20,6 +21,18 @@ @@ -20,6 +21,18 @@
20 21
21 self.view.backgroundColor = [UIColor blueColor]; 22 self.view.backgroundColor = [UIColor blueColor];
22 23
  24 + self.navigationItem.hidesBackButton = YES;
  25 + UIButton *button = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 44, 44)];
  26 + [button setImage:[[UIImage imageNamed:@"fanhui"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal];
  27 + [button addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside];
  28 + UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithCustomView:button];
  29 + UIBarButtonItem *negativeSpacer = [[UIBarButtonItem alloc]
  30 + initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace
  31 + target:nil action:nil];
  32 + negativeSpacer.width = -15;
  33 + self.navigationItem.leftBarButtonItems = @[negativeSpacer, backItem];
  34 +
  35 +
23 WKWebView *webView = [[WKWebView alloc]init]; 36 WKWebView *webView = [[WKWebView alloc]init];
24 [self.view addSubview:webView]; 37 [self.view addSubview:webView];
25 [webView mas_makeConstraints:^(MASConstraintMaker *make) { 38 [webView mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -32,10 +45,17 @@ @@ -32,10 +45,17 @@
32 45
33 } 46 }
34 47
  48 +- (void)back {
  49 +
  50 + [self.navigationController dismissViewControllerAnimated:YES completion:nil];
  51 +}
  52 +
35 #pragma mark - WKNavigationDelegate 53 #pragma mark - WKNavigationDelegate
36 // 页面开始加载时调用 54 // 页面开始加载时调用
37 - (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation{ 55 - (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation{
38 56
  57 + [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeClear];
  58 + [SVProgressHUD showWithStatus:@"正在加载..."];
39 } 59 }
40 // 当内容开始返回时调用 60 // 当内容开始返回时调用
41 - (void)webView:(WKWebView *)webView didCommitNavigation:(WKNavigation *)navigation{ 61 - (void)webView:(WKWebView *)webView didCommitNavigation:(WKNavigation *)navigation{
@@ -44,12 +64,15 @@ @@ -44,12 +64,15 @@
44 // 页面加载完成之后调用 64 // 页面加载完成之后调用
45 - (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation{ 65 - (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation{
46 66
  67 + [SVProgressHUD dismiss];
47 } 68 }
48 // 页面加载失败时调用 69 // 页面加载失败时调用
49 -- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation{ 70 +- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(NSError *)error {
50 71
51 - [Tools showHUDInView:self.view withString:@"加载失败,请稍后重试..." autoHide:YES]; 72 + [SVProgressHUD dismiss];
  73 + [self toast:@"加载失败,请稍后重试..."];
52 } 74 }
  75 +
53 // 接收到服务器跳转请求之后调用 76 // 接收到服务器跳转请求之后调用
54 - (void)webView:(WKWebView *)webView didReceiveServerRedirectForProvisionalNavigation:(WKNavigation *)navigation{ 77 - (void)webView:(WKWebView *)webView didReceiveServerRedirectForProvisionalNavigation:(WKNavigation *)navigation{
55 78
@@ -91,5 +114,19 @@ @@ -91,5 +114,19 @@
91 completionHandler(); 114 completionHandler();
92 } 115 }
93 116
  117 +- (void)toast:(NSString*)message { // 提示框
  118 +
  119 + UIAlertView *toast = [[UIAlertView alloc] initWithTitle:nil
  120 + message:message
  121 + delegate:nil
  122 + cancelButtonTitle:nil
  123 + otherButtonTitles:nil, nil];
  124 + [toast show];
  125 + double duration = 2.5;
  126 + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(duration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  127 + [toast dismissWithClickedButtonIndex:0 animated:NO];
  128 + });
  129 +}
  130 +
94 131
95 @end 132 @end
LiveVideoCloud/animation.xcassets/fanhui.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "idiom" : "universal",
  9 + "filename" : "fanhui.png",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "idiom" : "universal",
  14 + "scale" : "3x"
  15 + }
  16 + ],
  17 + "info" : {
  18 + "version" : 1,
  19 + "author" : "xcode"
  20 + }
  21 +}
0 \ No newline at end of file 22 \ No newline at end of file
LiveVideoCloud/animation.xcassets/fanhui.imageset/fanhui.png 0 → 100644

1.57 KB