UIScrollView has a property scrollEnabled to disable all scrolling, but I want to disable only the vertical scrolling.
Is that possible? Thanks.
UIScrollView has a property scrollEnabled to disable all scrolling, but I want to disable only the vertical scrolling.
Is that possible? Thanks.
If the scrollView's contentSize.height
is less than its bounds.size.height
it won't scroll vertically.
Try setting:
scrollView.contentSize = (CGSize){<yourContentWidth>, 1.0}
Swift
scrollView.contentSize = CGSize(width: <yourContentWidth>, height: 1.0)
- (void)scrollViewDidScroll:(UIScrollView *)aScrollView
{
[aScrollView setContentOffset: CGPointMake(aScrollView.contentOffset.x,0)];
}
you must have confirmed to UIScrollViewDelegate
aScrollView.delegate = self;