iOS调用HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>常用站点</title>
<!-- <link href="CSS/index.css" rel="stylesheet">-->
</head> <body>
<div id="header">常用站点</div>
<div id="content">
<ul>
<li class="first">第一口语网——完全免费英语口语学习的专业网站</li>
<li>hao123上网从这里开始</li>
<li>反馈中心 - 博客园</li>
<li>极客学院IT在线教育平台</li>
<li>Code4App-iOS开发</li>
<li>36氪_为创业者提供最好的产品和服务</li>
<li>百度网盘-全部文件</li>
<li>58同城</li>
<li>甘雨路 - 博客园</li>
<li>百度视频--全球最大中文视频搜索引擎</li>
<li>我的随笔 - 博客后台 - 博客园</li>
<li>NBA_百度搜索</li>
</ul>
</div>
</body>
</html>
#import "ViewController.h" @interface ViewController ()<UIWebViewDelegate> @property (nonatomic , strong) UIWebView *webView; @end @implementation ViewController - (void)viewDidLoad {
[super viewDidLoad];
// 创建webView
self.webView = [[UIWebView alloc] initWithFrame:CGRectMake(, , [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height)];
self.webView.delegate = self;
[self.view addSubview:self.webView]; // 加载本地网页
NSURL *url = [[NSBundle mainBundle] URLForResource:@"index" withExtension:@"html"];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[self.webView loadRequest:request];
} #pragma mark -- 操作网页 --
- (void)webViewDidFinishLoad:(UIWebView *)webView{
// 删除
NSString *str1 = @"var header = document.getElemenById('header'); ";
NSString *str2 = @"header.remove();";
[webView stringByEvaluatingJavaScriptFromString:str1];
[webView stringByEvaluatingJavaScriptFromString:str2]; // 更改网页的内容
NSString *str3 = @"var first = document.getElementsByClassName('first')[0];" "first.innerHTML = 'Apple 官网';" ;
[webView stringByEvaluatingJavaScriptFromString:str3]; // 插入图片
NSString *str4 = @"var img = document.createElement('img');"
"img.src = 'ply.png';"
"document.body.appendChild(img);";
[webView stringByEvaluatingJavaScriptFromString:str4];
} @end
iOS调用HTML的更多相关文章
- IOS修改webView背景透明以及IOS调用前台js的方法
工作上遇到IOS的webView中的H5页面需要透明以显示webView的背景颜色.用H5自身的透明度的css样式或者js控制背景颜色及透明度都打不到想要的效果,最后还是通过ios设置webView中 ...
- iOS调用QQ发起临时会话
iOS调用QQ发起临时会话 iOS调用qq前先判断是否安装qq, 之后通过OpenURL打开对用的qq NSURL *url = [NSURL URLWithString:@"mqq://& ...
- 转载 iOS js oc相互调用(JavaScriptCore) --iOS调用js
iOS js oc相互调用(JavaScriptCore) 从iOS7开始 苹果公布了JavaScriptCore.framework 它使得JS与OC的交互更加方便了. 下面我们就简单了解一下这 ...
- ios调用Html内JS alert 不能点击关闭为甚?
ios调用Html内JS alert 不能点击关闭为甚? This question gave me the most insight to the problem... Deadlock with ...
- 关于IOS调用微信支付jsapi不起作用的解决方法
微信支付时,安卓机调用 jsapi可以支付,IOS就不行,点击立即支付,直接返回原立即支付页面,跟刷新页面差不多,解决方案很简单:两句话而已. 不得不说,微信支付坑太多了,我擦..... <sc ...
- ios调用本地拨打电话,发送短信
电话.短信是手机的基础功能,iOS中提供了接口,让我们调用.这篇文章简单的介绍一下iOS的打电话.发短信在程序中怎么调用. 1.打电话 [[UIApplication sharedApplicat ...
- ios调用系统相册、相机 显示中文标题、本地化多语言支持
因为调用系统相册.相机需要显示中文,所以搞了半天才知道是在Project->info->Custom ios Target Properties 添加 Localizations 并加入C ...
- iOS 调用地图导航
在IOS6.0系统后,兼容iOS5.0与iOS6.0地图导航,需要分两个步骤 #define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevic ...
- ios 调用打印机
源码 无意中玩一个demo发现调用了打印机 才发现ios有快速调用打印机的功能. if ([UIPrintInteractionController isPrintingAvailable] == ...
- iOS调用系统通讯录获取姓名电话号码(转)
原文地址:http://blog.csdn.net/idoshi201109/article/details/46007125 OS调用系统通讯录获取姓名电话号码 (iOS 8.0 Xcode6.3可 ...
随机推荐
- nginx不支持pathinfo函数
server { listen ; server_name www.domain.com domain.com; error_page /.html; error_page /50x.html; lo ...
- 10. 求N分之一序列前N项和
求N分之一序列前N项和 #include <stdio.h> int main() { int i, n; double item, sum; while (scanf("%d& ...
- typecho流程原理和插件机制浅析(第二弹)
typecho流程原理和插件机制浅析(第二弹) 兜兜 393 2014年04月02日 发布 推荐 1 推荐 收藏 14 收藏,3.7k 浏览 上一次说了 Typecho 大致的流程,今天简单说一下插件 ...
- Xamarin 示例Standard Controls报错:xamarin Failed to compile interface file. See Build Output for details
Standard Controls 示例下载地址: http://developer.xamarin.com/content/StandardControls/ Xamarin官网上的IOS示例“St ...
- PHP 中获取当前时间[Datetime Now]
在 PHP 中可以通过date()获取当前时间,在>5.2的版本中最好还是用 datetime 类型 date() <?php echo date('Y-m-d H:i:s'); ?> ...
- a compromise between lock overhead and data safety
High Performance My SQL THIRD EDITION A locking strategy is a compromise between lock overhead and ...
- How Browsers Work: Behind the scenes of modern web browsers
http://www.html5rocks.com/en/tutorials/internals/howbrowserswork/#Parser_Lexer_combination Grammars ...
- mysql 权限篇
mysql库 user(用户以及所有库权限配置) db(具体库权限配置) 配置完毕要用命令 FLUSH PRIVILEGES; 刷新权限 备份数据库可以直接copy文件的形式,不过这样copy的文件会 ...
- JVM内存状况查看方法和分析工具-jmap
jmap -heap 27657 Attaching to process ID 27657, please wait... Debugger attached successfully. Serve ...
- 【Java 进阶篇】【第二课】异常处理
概念 异常处理的存在是为了: 允许程序员跳过无法处理的问题,继续开发后续的工作,或根据异常做出更加聪明的处理方式. Java中存在一类对象叫“异常对象”. 当异常情况发生时,就会暗战预先的设定,抛 ...