1.下载破解版
2.创建仓库
1.下载破解版
2.创建仓库
self.webview=[[UIWebView alloc]initWithFrame:CGRectMake(0, 0, self.view.bounds.size.height, self.view.bounds.size.width)]
[self.view addSubview:self.webview];
NSString urlstr=[NSString stringWithFormat:@"%@/game?gameinvitetoken=%@&hash=%@",GameUrl, _gametoket,_hashvalues];
NSURL *url = [NSURL URLWithString:urlstr];
[(UIScrollView *)[[self.webview subviews] objectAtIndex:0] setBounces:NO];
//webview不能弹跳
NSURLRequest request = [NSURLRequest requestWithURL:url];
/发送请求(webView加载方式)
//设置delegate
self.webview.delegate = self;
[self.webview setMediaPlaybackRequiresUserAction:NO];//webview加载声音
[self.webview loadRequest:request];
//开始加载
-
(void)webViewDidStartLoad:(UIWebView *)webView {
//设置顶部开始加载的加载圈
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
}
//加载成功
(void)webViewDidFinishLoad:(UIWebView *)webView {
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
}
//加载失败-
(void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
NSLog(@"加载百度主页失败:%@", error.userInfo);
}
// 感知界面跳转拦截
-(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
if (_number==1) {
_number=_number+1;
NSLog(@"%d",_number);
}else if(_number==2){
NSLog(@"界面跳转");
NSLog(@"%d",_number);
UIWindow *winow = [UIApplication sharedApplication].keyWindow;
[winow addSubview:self.bottomButton];
[winow addSubview:self.shareButton];
}
return YES;
}
获取webView页面内容信息:
NSString *docStr=[webView stringByEvaluatingJavaScriptFromString:@"document.documentElement.textContent"];//获取web页面内容信息,此处获取的是个json字符串
SBJsonParser *parserJson=[[[SBJsonParser alloc]init]autorelease];
NSDictionary *contentDic=[parserJson objectWithString:docStr];//将json字符串转化为字典
approvalWebView.backgroundColor=[UIColor clearColor];
approvalWebView.opaque=NO;//这句话很重要,webView是否是不透明的,no为透明 在webView下添加个imageView展示图片就可以了