久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

為什么 UIWebView 不應該放在 UIScrollView 中?

Why Shouldn#39;t A UIWebView Be Placed in a UIScrollView?(為什么 UIWebView 不應該放在 UIScrollView 中?)
本文介紹了為什么 UIWebView 不應該放在 UIScrollView 中?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

有誰知道在 iOS 上避免滾動視圖中的網頁視圖的技術原因(假設您愿意自己禁用網頁視圖中的滾動)?

Does anyone know of technical reasons for avoiding web views inside scroll views on iOS (assuming you're willing to disable scrolling inside the web views themselves)?

如果您查看 Apple 文檔對于 UIWebView,他們聲明:

If you look at the Apple docs for UIWebView, they state:

重要提示:您不應將 UIWebView 或 UITableView 對象嵌入UIScrollView 對象.如果這樣做,可能會導致意外行為因為兩個對象的觸摸事件可能會混淆和錯誤處理.

Important: You should not embed UIWebView or UITableView objects in UIScrollView objects. If you do so, unexpected behavior can result because touch events for the two objects can be mixed up and wrongly handled.

我的猜測

看起來他們可能是在警告您不要將滾動視圖放在另一個滾動視圖中,因為內部滾動視圖和外部滾動視圖之間的觸摸可能會混淆.

My Educated Guess

It looks like maybe they're warning you against putting a scroll view inside another scroll view, because touches can be confused between the inner, and outer scroll views.

但是,將 UIWebView 放在滾動視圖中是有充分理由的.Web 視圖不僅僅是 滾動視圖.UIWebView 可以輕松顯示范圍廣泛的web 內容.

But, there's a very valid reason to want to put a UIWebView inside a scroll view. Web views aren't just scroll views. UIWebView can easily display a wide range of web content.

如果不需要允許 UIWebView 本身內滾動,并且您使用以下任一方法關閉滾動:

If there is no need to allow scrolling within the UIWebView itself, and you turn off scrolling with either:

webView.userInteractionEnabled = NO;

webView.scrollView.scrollEnabled = NO;

那么這個設計真的有問題嗎?

then is there really any problem with this design?

我想知道這是否部分是原始 UIWebView 界面的工件,它沒有為您提供 直接(并記錄)訪問其嵌入的 UIScrollView (能夠輕松禁用其滾動).也許 Apple 文檔中的這句話是遺留下來的?

I'm wondering if this is partly an artifact of the original UIWebView interface, where it did not give you direct (and documented) access to its embedded UIScrollView (to be able to disable its scrolling easily). Maybe this statement in the Apple docs is a legacy of that?

我問是因為我正在維護一個應用程序(由其他人編寫),該應用程序在允許水平滾動的滾動視圖中使用少數 Web 視圖.Web 內容必須被認為是固定的(不可更改),并且每個 HTML 頁面只顯示一頁內容.用戶需要能夠在頁面之間滾動,因此為此選擇了 UIScrollView 內的多個 UIWebViews.到目前為止,它似乎可能工作正常.

I ask because I'm maintaining an app (written by someone else) that uses a handful of web views inside a scroll view that allows scrolling between them horizontally. The web content must be considered fixed (not changeable), and it only shows one page of content per HTML page. The user needs to be able to scroll between pages, so multiple UIWebViews inside a UIScrollView were chosen for that. So far, it appears that it may be working properly.

但是,頁面顯示全屏圖像,并且滾動性能是一個問題.但是,我正在嘗試確定滾動視圖中 Web 視圖的基本嵌套(Apple 警告不要這樣做)是否真的是問題的一部分.

However, the pages show full screen images, and scrolling performance is an issue. But, I'm trying to determine if the fundamental nesting of web views inside scroll views (which Apple warns against) is really part of the problem.

推薦答案

Apple 不建議將 UIWebViews 放在 UIScrollViews 中的唯一原因,如果你解釋的原因:因為滾動可能會在兩個滾動視圖之間混淆.

The only reason Apple does not recommend putting UIWebViews inside UIScrollViews if for the one you explain: because scrolling would risk to be mixed up between the two scroll views.

我猜他們寫這個是因為 UIWebView 繼承 UIView 而不是 UIScrollView,因此它本身不是滾動視圖(但嵌入一個),這對于沒有經驗的用戶來說可能并不明顯,Web 內容可以根據 HTML 滾動,如果有的話,這會弄亂容器滾動視圖.所以這可能只是對這個案例的提醒.

I guess they wrote this because, by the fact that UIWebView inherits UIView and not UIScrollView, and thus is not a scrollview itself (but embeds one), this may be not obvious for the unexperimented user that the web content can be scrollable depending on the HTML, which would mess up with the container scrollview if any. So that is probably just a reminder for this case.

但是如果你禁用滾動,我看不出有什么原因會出錯.

But if you disable the scrolling, I can't see any reason why this would go wrong.

請注意,在滾動視圖上禁用用戶交互與禁用滾動不同.如果您的 HTML 內容包含鏈接或其他可點擊/可點擊的內容,禁用用戶交互也會禁用它們.要僅禁用滾動但保持用戶交互(如簡單的點擊),請使用 webview.scrollView.scrollEnabled = NO 而不是 webview.scrollView.userInteractionEnabled = NO.

Note anyway that disabling user interaction on the scrollview is not the same as disabling scrolling. If your HTML content contains links or other clickable/tappable content, disabling user interaction will disable them too. To only disable scrolling only but keep user interaction like simple taps, use webview.scrollView.scrollEnabled = NO instead of webview.scrollView.userInteractionEnabled = NO.

這篇關于為什么 UIWebView 不應該放在 UIScrollView 中?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

UIButtons at the bottom of UIScrollView not working(UIScrollView 底部的 UIButtons 不起作用)
scrollViewWillEndDragging:withVelocity:targetContentOffset: not working on the edges of a UISCrollView(scrollViewWillEndDragging:withVelocity:targetContentOffset: 不在 UISCrollView 的邊緣工作) - IT屋-程序員軟件開發(fā)技術分享社
ImageView Scaling when scrolling down(向下滾動時 ImageView 縮放)
Bounds automatically changes on UIScrollView with content insets(UIScrollView 上的邊界自動更改,帶有內容插圖)
iOS5 UITapRecognizer for UIScrollView interfering with buttons. How to fix?(用于 UIScrollView 的 iOS5 UITapRecognizer 干擾按鈕.怎么修?)
Handling scroll views with (custom, interactive) view controller presentation and dismissal(使用(自定義、交互式)視圖控制器呈現和解除處理滾動視圖)
主站蜘蛛池模板: 国产精品成人一区二区 | 欧美a在线看| 日韩在线中文字幕 | 精品久久久久久亚洲综合网站 | 日本a视频| 91精品国产91综合久久蜜臀 | 天堂网中文 | 免费在线成人 | 成人在线免费观看av | 国产一在线观看 | 亚洲一区 中文字幕 | 性欧美xxxx| 51ⅴ精品国产91久久久久久 | 秋霞精品| 日韩精品专区在线影院重磅 | 欧美日韩一区二区在线观看 | 亚洲精品久久久9婷婷中文字幕 | 国产福利视频在线观看 | 99热在线播放 | 中文一区二区 | 久久亚洲一区二区 | 超碰成人在线观看 | 亚洲国产精品视频 | 在线小视频 | 91视视频在线观看入口直接观看 | 九九99九九精彩46 | 亚洲精品天堂 | 91社区视频 | 久久久国产一区二区三区 | 精品无码久久久久久国产 | 99热.com| 国产色婷婷精品综合在线手机播放 | 国产精品国产精品 | 日韩精品一区二区三区视频播放 | 免费国产视频在线观看 | 黄色一级片aaa | 在线观看中文字幕 | 天天玩天天干天天操 | 欧美精品一区二区免费 | 草草草网站 | 亚洲精品888 |