You might think that if you add the jquery js file to your project, you can build and reference it from html you load into a UIWebView. That’s what I thought too. Here are the steps you need to take.
1. Add the jquery file to resources. Drag the file in, right-click and choose to add an existing file. Whatever you are comfortable with.
2. The file will be automatically added as source code. In Xcode under Targets, expand the target you are working on and you’ll find two groups, “Copy Bundle Resources” and “Compile Resources”.
3. Drag the file from the “Compile Sources” group
to the “Copy Bundle Resources” group.
This tells Xcode to package the file up and include it with your app as a resource instead of compiling it.
4. Include the reference to jQuery in your HTML.
html = [NSString stringWithFormat:@"<html><head><script type='text/javascript' src='jquery-1.4.2.min.js'></script></head><body>%@</body></html>", body];
5. Set the baseURL using the path to your jQuery file.
[myWebView loadHTMLString:html baseURL:[NSURL fileURLWithPath:[[NSBundle mainBundle]pathForResource:@”jquery-1.4.2.min.js” ofType:nil]]];
分享到:
相关推荐
可选JS库文件:增强图片显示特效可使用jQuery插件Easing Plugin库文件 素材准备 可自定义CSS样式,控制jQuery插件jQuery Image Flyout提示小图片显示效果。 实例代码 一,包含文件部分 [removed][removed] ...
fullPage.js 是一个基于 jQuery 的插件,它能够很方便、很轻松的制作出全屏网站,主要功能有: 支持鼠标滚动 支持前进后退和键盘控制 多个回调函数 支持手机、平板触摸事件 支持 CSS3 动画 支持窗口缩放 窗口缩放时...
fullPage.js 是一个基于 jQuery 的插件,它能够很方便、很轻松的制作出全屏网站,主要功能有: 支持鼠标滚动 支持前进后退和键盘控制 多个回调函数 支持手机、平板触摸事件 支持 CSS3 动画 支持窗口缩放 窗口缩放时...
jQuery CSS3仿iPhone4S Siri UI
一款使用jquery结合swiper.js来制作的手机端带农历的万年历插件。该万年历类似百度的万年历,带有农历日期。用户可以通过类似iphone的滚轮来选择不同的的日期。
jQuery CSS仿iPhone手机滑动解锁屏幕
jQuery模拟iPhone获取WiFi网络列表代码,基于jquery-1.7.min.js制作。
js特效脚本含源码和说明jQuery实现的iPhone解锁界面本资源系百度网盘分享地址
分别引入jquery-ui-1.8.16.custom.min.js、jquery.1.7.js、modernizr-2.js、iphone.js几个脚本,由于使用了CSS3技术,因此在IE9以下版本的浏览器中显示效果有问题,请使用IE9、chrome、firefox等浏览器,截图如上所...
一款支持计次复位的jQuery仿iphone手机秒表计时器js代码。
Highcharts是一个制作图表的纯Javascript类库,主要特性如下: * 兼容性:兼容当今所有的浏览器,包括iPhone、IE和火狐等等; * 对个人用户完全免费; * 纯JS,无BS; * 支持大部分的图表类型:直线图,曲线图...
仿iPhone手机界面导航菜单,应用jQuery技术,DIV+CSS架构。 该网页菜单包含文件:html,css,js,images(PNG)
jQuery+CSS仿iPhone手机面板导航
所以我们要修改一下源文件jquery.easydrag.handler.beta2.js:找到 function(handlerId) 这个函数, 将里面的$(“#”+handlerId)都改成$(“.”+handlerId)就可以了。好吧,这样就可以了,下面是实例,高手们请 ...
•兼容性:兼容当今所有的浏览器,包括iPhone、IE和火狐等等; •对个人用户完全免费; •纯JS,无BS; •支持大部分的图表类型:直线图,曲线图、区域图、区域曲线图、柱状图、饼装图、散布图; •跨语言:不管是...
• 兼容性:兼容当今所有的浏览器,包括iPhone、IE和火狐等等; • 对个人用户完全免费; • 纯JS,无BS; • 支持大部分的图表类型:柱状图,直线图,曲线图、区域图、区域曲线图、饼装图、散布图等; • 跨语言:...
jQuery模拟iPhone手机,网页放大效果代码,iPhone放大镜.这只是仿的,不过效果挺逼真的,与以往的图片放大大同小异,在固定区域内放大图像,有兴趣的一看
仿iPhone手机界面导航菜单,应用jQuery技术,DIV CSS架构。 该网页菜单包含文件:html,css,js,images(PNG)
81、jQuery模拟iPhone获取WiFi网络列表代码