webView加载url,加载指定字符串
//加载url
-(void)addWebView{ UIWebView * webView = [[UIWebView alloc] initWithFrame:CGRectMake(, , zScreenWidth, )];
NSURLRequest *request =[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://%@",URL]]];
webView.delegate=self;
[self.view addSubview: webView]; self.HUB=[ZJStaticFunction showHubView:self.view]; if ([ZJStaticFunction isUserNetOK]) {
[self.HUB show:YES]; [webView loadRequest:request]; }else{
[ZJStaticFunction alertView:self.view msg:remindNetWord];
} } // 让浏览器加载指定的字符串,使用m.baidu.com进行搜索
- (void)loadString:(NSString *)str {
// 1. URL 定位资源,需要资源的地址
NSString *urlStr = str;
if (![str hasPrefix:@"http://"]) {
urlStr = [NSString stringWithFormat:@"http://m.baidu.com/s?word=%@", str];
} NSURL *url = [NSURL URLWithString:urlStr]; // 2. 把URL告诉给服务器,请求,从m.baidu.com请求数据
NSURLRequest *request = [NSURLRequest requestWithURL:url]; // 3. 发送请求给服务器
[self.webView loadRequest:request];
}
webView加载url,加载指定字符串的更多相关文章
- iOS中webView加载URL需要处理特殊字符
今天在项目中遇到webView加载URL时,因为URL中有特殊字符,导致页面无法加载,而且在- (BOOL)webView:(UIWebView )webView shouldStartLoadWit ...
- webview加载url出现空白页面,有些页面没问题
用webview加载url出现空白页,测试后把百度,Github之类的url传进去都没问题,后来发现是因为布局的原因,因为webview对不同的网站兼容性没有那么强,特别是现在出现的各种前端布局,没法 ...
- WebView加载URL跳转到系统浏览器的解决方法
1.问题 webview加载url跳转到系统浏览器,用户体验非常的差 2.解决方法 重写WebViewClient的shouldOverrideUrlLoading(WebView view, Str ...
- WebView 加载网页 加载资源 总结 MD
Markdown版本笔记 我的GitHub首页 我的博客 我的微信 我的邮箱 MyAndroidBlogs baiqiantao baiqiantao bqt20094 baiqiantao@sina ...
- 背水一战 Windows 10 (63) - 控件(WebView): 基础知识, 加载 html, http, https, ms-appx-web:///, embedded resource, ms-appdata:///, ms-local-stream://
[源码下载] 背水一战 Windows 10 (63) - 控件(WebView): 基础知识, 加载 html, http, https, ms-appx-web:///, embedded res ...
- Android中使用WebView, WebChromeClient和WebViewClient加载网页 (能够执行js)
Android中使用WebView, WebChromeClient和WebViewClient加载网页 在android应用中,有时要加载一个网页,如果能配上一个进度条就更好了,而android ...
- Android中使用WebView, WebChromeClient和WebViewClient加载网页
在android应用中,有时要加载一个网页,如果能配上一个进度条就更好了,而android 中提供了其很好的支持, 其中webView的一系列用法,比如 webView.getSettings().s ...
- URL加载系统----iOS工程师必须熟练掌握
URL加载系统----iOS工程师必须熟练掌握 iOS根本离不开网络——不论是从服务端读写数据.向系统分发计算任务,还是从云端加载图片.音频.视频等. 当应用程序面临处理问题的抉择时,通常 ...
- android WebView, WebChromeClient和WebViewClient加载网页基本用法
WebView, WebChromeClient和WebViewClient加载网页基本用法 webview是android中的浏览器控件,在一些手机应用中常会用到b/s模式去开发应用,这时webvi ...
随机推荐
- python no module named builtins
使用python2时出现此错误. 解决办法: pip install future
- 利用sqlmap注入测试
安装:yum install -y gitcd /usr/local && git clone https://github.com/sqlmapproject/sqlmap.gitc ...
- [转] history.back()和history.go()的区别
Javascript:history.go()和history.back()的用法和区别 go(-1): 返回上一页,原页面表单中的内容会丢失:history.go(-1):后退+刷新:history ...
- [转] React之Immutable学习记录
从问题说起:熟悉 React 组件生命周期的话都知道:调用 setState 方法总是会触发 render 方法从而进行 vdom re-render 相关逻辑,哪怕实际上你没有更改到 Compone ...
- [转]解决-Dmaven.multiModuleProjectDirectory system property is not set. Check $M2_HOME environment variable and mvn script match.
来源:http://www.cnblogs.com/sprinng/p/5141233.html 1.添加M2_HOME的环境变量 2.Preference->Java->Installe ...
- Spring boot自定义启动字符画(banner)
spring boot项目启动时会打印spring boot的ANSI字符画,可以进行自定义. 如何自定义 实现方式非常简单,我们只需要在Spring Boot工程的/src/main/resourc ...
- 在grails中远程调用action
在进行类似批处理的程序时,如果在一个action中需要保存很多记录数,这会导致grails中的数据库session超过负荷,从而导致OOM. 因为这个情况的发生是由于在一次请求中,对数据进行的修改都保 ...
- Centos安装Samba共享服务器
安装Samba 查看Samba是否已安装 1.# rpm -qa | grep samba
- net core体系-web应用程序-4net core2.0大白话带你入门-3asp.net core项目架构和配置文件解读
asp.net core web项目目录解读 Connected Services 和传统.net web项目相比,它的功能类似于添加webservice或者wcf service的引用.暂时用不 ...
- nginx-fastcgi 反向代理
Nginx处理php页面 用fpm-server 基于fastcgi模块实现 Ngx_http_proxy_module 只能反代后端http server的主机 Ngx_fastcgi_prox ...