Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disabling vertical scrolling in UIScrollView in swift?

So I have my UIScrollView,

    var myScrollView = UIScrollView(frame:theFrame)

and I would like to disable vertical scrolling. Does anyone know how to implement this using Swift?

like image 995
bhzag Avatar asked Aug 19 '14 03:08

bhzag


1 Answers

Try this. This sets the content size to the height of the frame so it disables vertical scrolling because it can display the whole size.

let scrollSize = CGSizeMake(theFrame.size.height, yourWidth)
myScrollView.contentSize = scrollSize
like image 142
Milo Avatar answered Oct 23 '22 16:10

Milo