i have a scrollView. i want it to scroll only in one direction(VERTICAL). Is there a way in which i can lock the horizontal scrolling...?? ...
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- how do you prevent page scroll in textarea on mobi
- how do you prevent page scroll in textarea on mobi
相关文章
- UITableView dragging distance with UIRefreshContro
- Could I create “Call” button in HTML 5 IPhone appl
- Gallery space at beginning and end
- Unable to process app at this time due to a genera
- How do you detect key up / key down events from a
- “Storyboard.storyboard” could not be opened
- Open iOS 11 Files app via URL Scheme or some other
- Can keyboard of type UIKeyboardTypeNamePhonePad be
If the UIScrollView's
contentSize
property has the same as the actual width of the UIScrollView, then no horizontal scrolling will be possible.Are you wanting to stop horizontal scrolling when horizontal scrolling would be valid? (i.e. the
contentSize
is wider than the actual UIScrollView width?) If 'yes', why are you wanting to do that?Same (adapted) answer for you as in:
Disabling vertical scrolling in UIScrollView
right, all answers here are ok...
but if for some strange reason your contentSize should be higher than the
UIScrollView
in both dimensions, you can disable the horizontal scrolling implementing theUIScrollView
protocol method-(void)scrollViewDidScroll:(UIScrollView *)aScrollView
just add this in your
UIViewController
it's just the method called when the user scroll your
UIScrollView
, and doing so you force the content of it to have always the same .x
oh since iOS7 use this (in initWithNibName):
and create the page scroller with 3 pages
See this question, you have to set the scrollable size to the corresponding size of the view so that there is nothing to scroll.
Swift
Make
contentOffset.x = 0
for disable horizontal scrollAdditionally you can disable scroll indicator as
You can try this,
here 1450 is my view height.