HTML5接入與OC互動
////螢幕
#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
相關文章
- OC WKWebView的JS與OC互動、Cookie管理WebViewJSCookie
- oc 與js 的原生互動JS
- JS 與 OC 互動的三種方法JS
- oc 與 js互動之vue.jsVue.js
- Cordova JS OC互動方法JS
- swift3.0與OC的互動注意事項Swift
- OC與C++ 混編的檔案互動C++
- iOS開發:網頁JS與OC互動(JavaScriptCore)iOS網頁JSJavaScript
- 13 Android與HTML5互動AndroidHTML
- WebViewJavascriptBridge JS和OC互動WebViewJavaScriptJS
- weex與android互動初步接入,遇到的坑Android
- ios/oc中的結構體 與字串互轉iOS結構體字串
- js 與WKWebView 互動JSWebView
- 互動與關係
- MySQL 與OS互動MySql
- WKWebView與JS互動WebViewJS
- 微互動(五)——微互動的迴圈與模式模式
- HTML5 和 CSS3的新互動特性HTMLCSSS3
- Java與Excel的互動!-JavaExcel
- Android 與前端互動Android前端
- Lua 與 ObjC 的互動OBJ
- webview與JS的互動WebViewJS
- Android中程式與Service互動的方式——互動方式Android
- OC:類與物件☀️物件
- 基於 HTML5 Canvas 的可互動旋鈕元件HTMLCanvas元件
- 利用HTML5,無JS實現各種互動效果HTMLJS
- 基於HTML5 Canvas實現使用者互動HTMLCanvas
- HTML5和CSS3中的互動新特性HTMLCSSS3
- HTML5:Web遊戲中的GUI設計和互動HTMLWeb遊戲GUI
- Flutter 與Native原生互動Flutter
- Flutter 與 Android 的互動FlutterAndroid
- ajax與XML檔案互動XML
- ReactNative與iOS的互動ReactiOS
- Spring 容器與 Servlet互動SpringServlet
- RN 與android原生互動Android
- iOS與H5互動iOSH5
- H5 與 APP 互動!H5APP
- Swift與OC的不同Swift