Disable vertical scroll in UIScrollView Swift
Since iOS 11 content insets can get adjusted automatically. Try setting your scrollview's behaviour to not adjust it.
if #available(iOS 11, *) {
scrollview.contentInsetAdjustmentBehavior = .never
}
Disabling Horizontal Scrolling from UIScrollView Swift
Like this,
Swift 4.0
func scrollViewDidScroll(scrollView: UIScrollView) {
if scrollView.contentOffset.x>0 {
scrollView.contentOffset.x = 0
}
}
And, you can set this property:
scrollImg.isDirectionalLockEnabled = true
Disabling vertical scrolling in UIScrollView in swift?
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
Disabling vertical scrolling in UIScrollView
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);
How to disable vertical scrolling in UIScrollView (Obj-C)
you must set your scrollview content height to the scroll view height
CGSize scrollableSize = CGSizeMake(scrollableWidth, yourScrollViewHeight);
[myScrollView setContentSize:scrollableSize];
Related Topics
Please Specify a Platform for This Target in Your Podfile
Swift Select All Photos from Specific Photos Album
Code Coverage Result Is Not Accurate to Real Coverage in Xcode 7
How to Hide API Keys in Github for iOS (Swift) Projects
How to Refresh a Timer in a Today Widget
Output Video Size Huge Using Hevc Encoder on iOS
How to Run an iOS Application Every 1 Minute Infinitely
How to Share Published Model Between Two View Models in Swiftui
Why am I Getting Com.Facebook.Sdk.Login Error 308
Split String into Array of Arrays
Swift 3 Imessage Extension Doesn't Open Url
Using Static Libraries with Cocoapods 1.5 No Such Module at Import
Recognizing Touch Events Only Inside the Masked View
Swift Get Specific Value from Firebase Database
Manage a Uipickerview from an External Class - Using Swift
Audiokit - How to Get Real Time Floatchanneldata from Microphone