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

限制 UIScrollView 中的可滾動區域

Limiting the scrollable area in UIScrollView(限制 UIScrollView 中的可滾動區域)
本文介紹了限制 UIScrollView 中的可滾動區域的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我有一個 UIScrollView 正在滾動一個相當大的 UIView.

I have a UIScrollView that is scrolling a fairly large UIView.

在某些時候我想限制用戶可以滾動的區域.例如,我可能只想讓他們查看視圖的底部四分之一.

At certain times I want to limit the area the user can scroll around in. For example, I may only want to allow them to view the bottom quarter of the view.

如果視圖滾動得太遠,我可以通過覆蓋 scrollViewDidScroll 然后調用 setContentOffset 來限制區域.但是這樣我就不能讓它像 UIScrollView 在滾動超出 UIView 的邊界時那樣平滑地反彈.

I am able to limit the area by overriding scrollViewDidScroll and then calling setContentOffset if the view has scrolled too far. But this way I can't get it bounce back as smoothly as the UIScrollView can naturally do when scrolling beyond the bounds of the UIView.

有沒有更好的方法來限制 UIScrollView 中的可滾動區域?

Is there a better way to limit the scrollable area in a UIScrollView?

推薦答案

我會將滾動視圖的 contentSize 屬性更改為您希望用戶能夠滾動的區域的大小并調整 frame.origin您想要的子視圖的左上邊界相對于滾動視圖顯示在 (0, 0) 處.例如,如果您的視圖高度為 800 磅,并且您想顯示底部四分之一,請將 contentSize 的高度設置為 200,并將 view.frame.origin 的 y 分量設置為 -600.

I would change the contentSize property of the scroll view to the size of the area you want the user to be able to scroll around in and adjust the frame.origin of the subview such the upper left boundary you want appears at (0, 0) relative to the scroll view. For example, if your view is 800 points tall and you want to show the bottom quarter, set the height of contentSize to 200 and set the y component of view.frame.origin to -600.

這篇關于限制 UIScrollView 中的可滾動區域的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

How to subclass UIScrollView and make the delegate property private(如何繼承 UIScrollView 并使委托屬性私有)
Swift - how to get last taken 3 photos from photo library?(Swift - 如何從照片庫中獲取最后拍攝的 3 張照片?)
Setting contentOffset programmatically triggers scrollViewDidScroll(以編程方式設置 contentOffset 觸發 scrollViewDidScroll)
Photos app-like gap between pages in UIScrollView with pagingEnabled(使用 pagingEnabled 的 UIScrollView 中頁面之間的照片應用程序式間隙)
why UIScrollView is leaving space from top in ios 6 and ios 7(為什么 UIScrollView 在 ios 6 和 ios 7 中從頂部留下空間)
UIScrollView pauses NSTimer while scrolling(UIScrollView 在滾動時暫停 NSTimer)
主站蜘蛛池模板: 尤物在线精品视频 | 色综合久久天天综合网 | 97视频久久 | 国产精品久久久久久妇女6080 | 日本一道本 | 91精品中文字幕一区二区三区 | 在线观看深夜视频 | 亚洲精品18 | 蜜桃av鲁一鲁一鲁一鲁 | 日本精品一区二区三区视频 | 欧美日韩免费视频 | 在线一区观看 | 范冰冰一级做a爰片久久毛片 | 欧美日本高清 | 精品亚洲一区二区三区 | 国产激情视频在线观看 | 久久久www成人免费精品张筱雨 | 狠狠操狠狠干 | 成人一区二 | 欧美在线小视频 | www.国产精 | 一级看片 | 国产精品久久久久久久久久三级 | 国产精品美女久久久av超清 | 久久久久国产精品 | 91精品国产92| 在线免费观看a级片 | 一级黄在线观看 | 午夜日韩 | 中文字幕一区二区三区四区五区 | 欧美成人自拍视频 | 伦理午夜电影免费观看 | 午夜日韩精品 | 国产精品精品视频一区二区三区 | 亚洲综合在线一区 | 国产乱码精品1区2区3区 | 香蕉av免费| 欧美一级黑人aaaaaaa做受 | 中文字字幕一区二区三区四区五区 | av网站免费观看 | 欧美a级成人淫片免费看 |