UIWebView:如何隐藏网页的部分内容? [英] UIWebView: how to hide part of the content of a webpage?

查看:33
本文介绍了UIWebView:如何隐藏网页的部分内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我有一个仅用于显示 facebook 页面的 webview.但是,客户端不希望出现 facebook 顶部的蓝色栏;他想隐藏它.有没有办法做到这一点?该栏是 45 像素,所以我所做的是在 IB 中移动 UIWebView,使其前 45 像素位于导航栏后面(因此不会出现).然而,这不是一个理想的解决方案,因为用户在弹跳之前向上滚动时可以看到该内容.他可以看到但不能触摸它,这会让一些用户感到沮丧.我尝试关闭弹跳,但随后 UI 变得过于僵化,而且不流畅.我在 Google 和 Stackoverflow 上查了几个小时,但没有找到解决方案.

In my app I have a webview that is used solely for displaying the facebook page. However, the client does not want the top blue bar of facebook to appear; he wants to hide it. Is there a way to do this? The bar is 45 pixels, so what I did is I moved the UIWebView in IB in such a way that its top 45 pixels are behind my navigation bar (thus not appearing). However, this is not an ideal solution, as the user can see that content when he scrolls up, before bouncing. He can see but not touch it, which will be frustrating for some users. I tried turning the bouncing off, but then the UI becomes too rigid, and not fluid. I looked up in Google and Stackoverflow for a couple of hours but didn`t find a solution.

非常感谢!

推荐答案

您必须编辑页面本身的 HTML/CSS 以隐藏有问题的 HTML 元素,可能使用正则表达式,并将其提供给您的 UIWebView与 loadHTMLString:baseURL:.

You'll have to edit the HTML/CSS of the page itself to hide the HTML elements in question, probably using regular expressions, and feed it into your UIWebView with loadHTMLString:baseURL:.

我之前做过类似的操作并且它有效,但是...当有问题的网页不属于您时,情况就不同了.任何时候 Facebook 更新其布局时,您的应用行为都可能会发生变化,直到您有时间获得应用更新的批准.客户想要他们想要的东西,但要确保您的客户知道他要什么!

I've done similar manipulating before and it works, but... it's a different ballgame when the webpages in question don't belong to you. Any time Facebook updates their layout, your app behavior might change until you have time to get an app update approved. Clients want what they want, but make sure your client knows what he's asking for!

这篇关于UIWebView:如何隐藏网页的部分内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆