問題描述
我還沒有嘗試過,但我認為一旦我知道用戶想要在子滾動視圖中滾動,我就必須禁用父滾動視圖的滾動,對吧?
I haven't tried that yet, but I assume that I would have to disable scrolling of the parent scroll view as soon as I know that the user will want to scroll in the child scroll view, right?
兩個滾動視圖都是水平滾動的.
Both scroll views are scrolling horizontal.
如何暫時禁用父級的滾動檢測?還是有其他方法?
How could I disable scrolling detection of the parent temporarily? Or is there some other way?
推薦答案
UIScrollView 有一個名為 scrollEnabled
的屬性,您可以將其設置為 NO
以禁用父級中的滾動滾動視圖.
UIScrollView has a property called scrollEnabled
, which you can set to NO
to disable scrolling in your parent scroll view.
我還沒有嘗試過,但您可能會發現它做正確的事,即內部滾動視圖滾動直到它不能再滾動,此時外部滾動視圖滾動.
I haven't tried it yet, but you may just find that it Does The Right Thing, i.e., the inner scroll view scrolls until it can't scroll any more, at which point the outer scroll view scrolls.
這篇關于如何在 UIScrollView 中嵌套 UIScrollView,以便用戶可以滾動內部 UIScrollView?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!