Reputation: 884
I have a button in my application which is supposed to scroll the scrollview from bottom to top (like "dragging" the scrollview from the bottom of the screen. The problem is that everything is inside this scrollview (2 view controllers are subviews of this scrollview - one is currently visible and second one is in the bottom of the screen unseen). That means that if I drag from everywhere on the screen, my second view controller gets dragged from the bottom of the page, which I don't want to happen.
Is there a way to recognise a touch point in scrollview and, according to the position of this touch, enable scrolling the scrollview?
Please advise, Thanks!
Upvotes: 0
Views: 76
Reputation: 20410
Try this:
CGPoint locationPoint = [[touches anyObject] locationInView:self.view];
CGPoint viewPoint = [myScrollView convertPoint:locationPoint fromView:self.view];
if ([myScrollView pointInside:viewPoint withEvent:event]) {
//do something
}
Upvotes: 1