隐藏UIWebView上的内容 [英] Hide content on a UIWebView
问题描述
我正在使用Xcode开发适用于iOS的应用程序,我想隐藏页面的某些内容并仅保留其中心. 例如: http://imageshack.com/a/img661/8407/X5KuuN.png一个>. 如果隐藏内容太复杂,则足以迫使页面位于页面中间的中心(用户无法移动页面,页面将加载到中心).
I'm working on an application for iOS in Xcode, i want to hide some content of my page and keep only the center of it. E.g : http://imageshack.com/a/img661/8407/X5KuuN.png. If it's too complicate to hide contents, it would be enough to force the page to be at the center, in the middle of the page (user can't move the page and the page will load in the center).
感谢帮助.
推荐答案
您可以通过在WebViewDidFinishLoad阶段使用[yourWebView stringByEvaluatingJavaScriptFromString: yourJSCodeString]
函数注入" JavaScript来删除/修改不需要的DOM
元素.
You can remove/modify the unwanted DOM
elements by "injecting" javascript at webViewDidFinishLoad stage with [yourWebView stringByEvaluatingJavaScriptFromString: yourJSCodeString]
function.
这篇关于隐藏UIWebView上的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!