本文介紹了在 UIScrollView 中禁用垂直滾動的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!
問題描述
IB 中有一個選項可以取消選中滾動視圖上的垂直滾動,但它似乎不起作用.
There is an option in IB to uncheck vertical scrolling on a scrollview, but it doesnt seem to work.
如何在代碼而不是IB中將scrollview設(shè)置為只水平滾動,而不是垂直滾動?
How can the scrollview be set to only scroll horizontally, and not vertically in the code rather than IB?
推薦答案
嘗試將 contentSize 的高度設(shè)置為 scrollView 的高度.然后應(yīng)該禁用垂直滾動,因為沒有任何東西可以垂直滾動.
Try setting the contentSize's height to the scrollView's height. Then the vertical scroll should be disabled because there would be nothing to scroll vertically.
scrollView.contentSize = CGSizeMake(scrollView.contentSize.width,scrollView.frame.size.height);
這篇關(guān)于在 UIScrollView 中禁用垂直滾動的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!