0

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!

Cosmin
  • 2,840
  • 5
  • 32
  • 50
  • CHeck this link http://stackoverflow.com/questions/9637203/ios-check-direction-of-scroll-in-uiscrollview it may help you .Thanks!! – Kiran Apr 04 '12 at 11:55

1 Answers1

1

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);
Malek_Jundi
  • 6,140
  • 2
  • 27
  • 36
  • I think you misunderstood my question. I still need to be able to scroll vertically, but I don't want to drag diagonally. I think I found a solution, someone asked a similar question, and it has quite interesting answers. – Cosmin Apr 04 '12 at 11:51
  • i think you need to review your question because you said that your problem "it still scrolls in both directions. How can I stop this for happening" ! what does this mean ?!! – Malek_Jundi Apr 04 '12 at 12:02
  • You're right, I didn't formulate my question right. My problem is actually that is scrolls diagonally. Fortunately I have solved this by using one main UIScrollView, that scrolls horizontally, and there "child" UIScrollViews that scroll only vertically. Thank you for your help. – Cosmin Apr 04 '12 at 12:11