Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

HTML5 access and OC interaction

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

/ screen

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

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

# import "SHFindVC.h"

/ /

/ HTML5 access test

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

/ / formal service

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:@ "prompt" message:@ "to apply for login request!" Delegate:nil cancelButtonTitle:@ "OK" 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]

}

/ / hide the top navigation bar

-(void) viewWillAppear: (BOOL) animated {

[self setFullScreen:YES]

}

-(void) viewWillDisappear: (BOOL) animated {

[self setFullScreen:NO]

}

-(void) setFullScreen: (BOOL) fullScreen {

/ / status bar

[UIApplication sharedApplication] .statusBarHidden = fullScreen

/ / Navigation bar

[self.navigationController setNavigationBarHidden:fullScreen]

/ / the hiding of tabBar is achieved by setting the hidesBottomBarWhenPushed property in the initialization method.

}

@ end

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report