I'm trying to make a class (ScrollableView : UIScrollView) that can always scroll vertically, similar to a TableView. I've hardcoded a constant value to add to the content size so that it can always be scrollable. For some strange reason though, it won't work when the value is 1; it will only work if the value is 4 or more.
- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
self.contentSize = CGSizeMake(frame.size.width, frame.size.height+1);
self.scrollEnabled = YES;
}
return self;
}
Is there another way to do this? This doesn't seem to be the proper way.
A floating-point value that determines the rate of deceleration after the user lifts their finger. We can assume that this rate indicates how much the scroll velocity will change after one millisecond (all UIScrollView values are expressed in milliseconds, unlike UIPanGestureRecognizer ).
How about setting
alwaysBounceVertical = YES
In Swift:
scrollView.alwaysBounceVertical = true
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With