HTML5接入与OC交互-创新互联-成都创新互联网站建设

关于创新互联

多方位宣传企业产品与服务 突出企业形象

公司简介 公司的服务 荣誉资质 新闻动态 联系我们

HTML5接入与OC交互-创新互联

////屏幕

创新互联公司是一家以成都网站建设、网页设计、品牌设计、软件运维、营销推广、小程序App开发等移动开发为一体互联网公司。已累计为成都加固等众行业中小客户提供优质的互联网建站和软件开发服务。

#define SHENGHUO_WIDTH    ([UIScreen mainScreen].bounds.size.width)

#define SHENGHUO_HEIGHT   ([UIScreen mainScreen].bounds.size.height)

#import "SHFindVC.h"

//

////HTML5接入测试

//#import "WebViewJavascriptBridge.h"

//#import "Html5ReportWebView.h"

@interface SHFindVC ()

@end

@implementation SHFindVC

- (void)viewDidLoad {

  [super viewDidLoad];

  _commodityHtml.delegate=self;

  NSUserDefaults *userInfo = [NSUserDefaults standardUserDefaults];

    NSMutableArray *userid = [userInfo objectForKey:@"userId"];

  //正式服

    NSString *newUrl = [NSString stringWithFormat:@"%@",userid];

    NSLog(@"%@",newUrl);

  NSURL *htmlUrl = [NSURL URLWithString:@"http://"];

  

    NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@",htmlUrl,newUrl]];

  

    NSLog(@"%@",url );

  [_commodityHtml loadRequest:[NSURLRequest requestWithURL:url]];

  

  

  

}

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {

  

 

    NSString *absoluteString = request.URL.absoluteString;

    NSLog(@"TAP == %@",absoluteString);

    if ([absoluteString rangeOfString:@"login"].location != NSNotFound) {

      

      UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:@"提示" message:@"申请请求登录!!" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles: nil];

        [alertView show];

      

    }

  

  

return YES;

  

}

- (IBAction)addContent:(id)sender {

  NSString * js = @" var p = document.createElement('p'); p.innerText = 'new Line';document.body.appendChild(p);";

  [_commodityHtml stringByEvaluatingJavaScriptFromString:js];

}

//隐藏顶部导航栏

- (void)viewWillAppear:(BOOL)animated {

    [self setFullScreen:YES];

  }

 - (void)viewWillDisappear:(BOOL)animated {

    [self setFullScreen:NO];

 }

 - (void)setFullScreen:(BOOL)fullScreen {

    // 状态条

    [UIApplication sharedApplication].statusBarHidden = fullScreen;

  // 导航条

    [self.navigationController setNavigationBarHidden:fullScreen];

  // tabBar的隐藏通过在初始化方法中设置hidesBottomBarWhenPushed属性来实现。

 }

@end


网页题目:HTML5接入与OC交互-创新互联
本文链接:http://kswsj.cn/article/eedso.html

其他资讯