网站建设资讯

NEWS

网站建设资讯

HTML5接入与OC交互

////屏幕

10余年的垦利网站建设经验,针对设计、前端、开发、售后、文案、推广等六对一服务,响应快,48小时及时工作处理。营销型网站的优势是能够根据用户设备显示端的尺寸不同,自动调整垦利建站的显示方式,使网站能够适用不同显示终端,在浏览器中调整网站的宽度,无论在任何一种浏览器上浏览网站,都能展现优雅布局与设计,从而大程度地提升浏览体验。创新互联从事“垦利网站设计”,“垦利网站推广”以来,每个客户项目都认真落实执行。

#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"

@interfaceSHFindVC ()

@end

@implementation SHFindVC

- (void)viewDidLoad {

    [superviewDidLoad];

   _commodityHtml.delegate=self;

   NSUserDefaults *userInfo = [NSUserDefaultsstandardUserDefaults];

   NSMutableArray *userid = [userInfoobjectForKey:@"userId"];

   //正式服

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

   NSLog(@"%@",newUrl);

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

    

   NSURL *url = [NSURLURLWithString:[NSStringstringWithFormat:@"%@%@",htmlUrl,newUrl]];

    

   NSLog(@"%@",url );

    [_commodityHtmlloadRequest:[NSURLRequestrequestWithURL:url]];

    

    

    

}

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

    

   

   NSString *absoluteString = request.URL.absoluteString;

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

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

        

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

        [alertViewshow];

        

    }

    

    

returnYES;

    

}

- (IBAction)addContent:(id)sender {

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

    [_commodityHtmlstringByEvaluatingJavaScriptFromString:js];

}

//隐藏顶部导航栏

- (void)viewWillAppear:(BOOL)animated {

      [selfsetFullScreen:YES];

  }

 - (void)viewWillDisappear:(BOOL)animated {

      [selfsetFullScreen:NO];

 }

 - (void)setFullScreen:(BOOL)fullScreen {

    //状态条

     [UIApplicationsharedApplication].statusBarHidden = fullScreen;

  //导航条

     [self.navigationControllersetNavigationBarHidden:fullScreen];

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

 }

@end


当前题目:HTML5接入与OC交互
当前路径:http://cdweb.net/article/iedpji.html