久久久久久久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)
主站蜘蛛池模板: 精品视频在线观看 | 亚洲国产精品va在线看黑人 | 亚洲aⅴ精品 | 日本欧美黄色片 | 日日做夜夜爽毛片麻豆 | 日日爱夜夜操 | 欧美亚洲国语精品一区二区 | 污片在线免费观看 | 日韩亚洲视频 | 亚洲欧美日韩精品久久亚洲区 | 午夜激情视频 | 91福利在线导航 | 国产伦精品一区二区三区视频金莲 | 97日韩精品 | 亚洲精品国产精品国自产在线 | 国产精品揄拍一区二区 | 日韩av啪啪网站大全免费观看 | 天天看天天操 | 久热电影| 免费观看一级特黄欧美大片 | 久久久欧洲 | 成人超碰 | 99热在线播放 | 网络毛片 | 黄色在线免费观看 | 98久久 | 久久99精品国产 | 免费在线视频一区二区 | 黄色免费在线网址 | 国产精品不卡一区 | 精品一区二区三区入口 | 91资源在线 | 久久精品视频在线免费观看 | 欧洲精品码一区二区三区免费看 | jizz在线看片| 国产98色在线 | 日韩 | 男女羞羞视频大全 | 国产精品国产成人国产三级 | 男女视频在线观看网站 | 亚洲精品在线视频 | 亚州精品天堂中文字幕 |