tags:

views:

58

answers:

2

Hi I have 2 UIScrollViews, 1 which scrolls vertically. Inside is a UIScrollView which scrolls horizontally with a long image.

Befor placing the horizontal scroller inside the original UIScrollView I could press the time at the top and it would scroll to the top, where now it doesnt.

I tried using this code

[mainScrollView setScrollsToTop:YES];
[horizontalScrollView setScrollsToTop:NO];

but this doesn't seem to sort it out.

Any ideas?

A: 

This is expected behavior.

From the UIScrollView API:

This gesture works on a single visible scroll view; if there are multiple scroll views (for example, a date picker) with this property set, or if the delegate returns NO in scrollViewWillScrollToTop:, UIScrollView ignores the request.

Saurabh G
hi thanks for the answers. I had another look at it and it does work - there was a small typo…
Matthew Pateman
A: 

Try to use UIGestureRecognizer to sort this kinds of things out.

They are adaptable and the preferred method of Gesture handling from iOS 3.2 forward.

You may have to handle Swipe Events in the inner view yourself.

Rui