Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Controlling scrolling on scrollview within scrollview

fruhofruho usaPosts: 2New Users
I have a container view inside a scrollview (see attached picture), and have programmatically built a scrollview within that container view (the scrollview pages left and right, scrolls up and down).
The problem is that when the user reaches the bottom of the inner scrollview (scrollView), and then tries to scroll down again, the whole outer scrollview (statscroller) scrolls with it. I want to have the scrollviews scroll independently of each other - that is, when scrollView is done scrolling, and the user tries to scroll down again on scrollView, nothing happens.
So far, I have
- (void)scrollViewDidScroll:(UIScrollView *)scroller { float scrollViewHeight = scrollView.frame.size.height; float scrollContentSizeHeight = scrollView.contentSize.height; float scrollOffset = scrollView.contentOffset.y; if (scrollOffset + scrollViewHeight == scrollContentSizeHeight) { [parent.statscroller setScrollEnabled:NO]; } else if (scrollOffset +scrollViewHeight != scrollContentSizeHeight) { [parent.statscroller setScrollEnabled:YES]; } }
This code ensures that when scrollView reaches the bottom, the statscroller is disabled, and when the user tries to scroll down again on scrollView, nothing happens. However, by disabling statscroller, the user is unable to scroll at all. I want to be able to scroll on the statscroller while scrolling on scrollView is disabled.
This is probably a pretty convoluted post to read, but I'd appreciate any help. Thanks.

Replies

  • ryantcbryantcb Posts: 666Registered Users @ @ @
    Nslog your if statements see if being called. Or perhaps try setting NO to user interaction enabled
Sign In or Register to comment.