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?
另一种方法是将高度设置为1.0
scrollView.contentSize = CGSizeMake(theFrame.size.height, 1.0)
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.