ifish/Ifish/controllers/IfishTabControllers/设备/IfishLoadingWebViewControll...

94 lines
3.1 KiB
Objective-C

//
// IfishLoadingWebViewController.m
// Ifish
//
// Created by imac on 2017/4/19.
// Copyright © 2017年 lianlian. All rights reserved.
//
#import "IfishLoadingWebViewController.h"
#import <WebKit/WebKit.h>
#import <MediaPlayer/MediaPlayer.h>
#import "NJKWebViewProgressView.h"
#import "NJKWebViewProgress.h"
#import "IfishMianTabViewController.h"
@interface IfishLoadingWebViewController ()<NJKWebViewProgressDelegate,UIWebViewDelegate>
{
NJKWebViewProgressView *_progressView;
NJKWebViewProgress *_progressProxy;
}
@property(nonatomic,strong)UIWebView*myWebView;
@end
@implementation IfishLoadingWebViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[self addTitleViewWithTitle:@"详情"];
[self creatwebView];
}
#pragma mark - NJKWebViewProgressDelegate
-(void)webViewProgress:(NJKWebViewProgress *)webViewProgress updateProgress:(float)progress
{
[_progressView setProgress:progress animated:YES];
//self.title = [self.myWebView stringByEvaluatingJavaScriptFromString:@"document.title"];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(void)creatwebView{
self.myWebView.opaque=NO;
self.myWebView.backgroundColor=[UIColor clearColor];
self.myWebView=[[UIWebView alloc]initWithFrame:self.view.bounds];
[self.view addSubview:self.myWebView];
//self.myWebView.delegate=self;
_progressProxy = [[NJKWebViewProgress alloc] init]; // instance variable
self.myWebView.delegate = _progressProxy;
_progressProxy.webViewProxyDelegate = self;
_progressProxy.progressDelegate = self;
CGFloat progressBarHeight = 2.f;
CGRect navigationBarBounds = self.navigationController.navigationBar.bounds;
CGRect barFrame = CGRectMake(0, navigationBarBounds.size.height - progressBarHeight, navigationBarBounds.size.width, progressBarHeight);
_progressView = [[NJKWebViewProgressView alloc] initWithFrame:barFrame];
_progressView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin;
NSURLRequest*requst=[NSURLRequest requestWithURL:[NSURL URLWithString:self.pushlink]];
//NSString*url=[NSString stringWithFormat:@"https://bg.zhangxinyanv5.top/ueditorHtml/1484032071200.html"];
//NSURLRequest*requst=[NSURLRequest requestWithURL:[NSURL URLWithString:url]];
[self.myWebView loadRequest:requst];
}
-(void)goBackAction{
[self setAppTabRoot];
}
//设置根视图
-(void)setAppTabRoot{
IfishMianTabViewController *mianVC=[[IfishMianTabViewController alloc] init];
[UIApplication sharedApplication].delegate.window.rootViewController=mianVC;
}
/*
#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