Cosmin
Cosmin

Reputation: 2898

UIScrollView scrolling directions

I am using a UIScrollView to scroll horizontally between 3 different UIViews (I call them pages because I have scrollView.pagingEnabled=YES;). Each page can also be scrolled vertically. My problem is that even if I use scrollView.directionalLockEnabled=YES; it still scrolls in both directions. How can I stop this for happening. (I want a similar behavior with the one that the Calendar app has, when Day mode is selected; I have already checked some calendar apps, but they don't have the horizontal scrolling enabled).

Thank you!

Upvotes: 0

Views: 1749

Answers (1)

Malek_Jundi
Malek_Jundi

Reputation: 6160

set the content size of the scrollView to be equal of the scrollView height.

scrollView.contentSize = CGSizeMake(scrollView.frame.size.width * pages.count,scrollView.frame.size.height);

Upvotes: 1

Related Questions