I've read the various threads on this but none have given me the exact solution I need, but they have got me pretty close
I have the topmost UIViewController which contains a paging UIScrollingView (created via the xib)
The UIScrollingView loads an array of dummy viewcontrollers which are swapped for various viewControllers as the user swipes through the pages.
One of these subviews contains a bunch of sliders - the usual problem: if the user misses a slider slightly they scroll the page instead.
Within the subview I placed a UIView behind the sliders partially covering the screen: 'uiviewblocker'
The idea is that this 'uiviewblocker' eats any touches in the immediate area around the sliders, but swipes outside the uiview are handled by the parent UIViewController. I subclassed the UIView 'uiviewblocker' to a duplicate UIViewController 'MyView' so I can detect it.
I've got as far as...
The parent UIScrollView:
scrollView.delaysContentTouches = NO;
The subview UIViewController
-(void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event {
NSLog(@"touchesBegan");
//[self.nextResponder touchesBegan: touches withEvent:event];
UIView *touchView = [[touches anyObject] view];
if ([touchView isKindOfClass:[MyView class]]) {
NSLog(@"funky shit");
[super touchesBegan:touches withEvent:event];
//[self.delegate touchesBegan:touches withEvent:event];
//[self touchesBegain:touches withEvent:event]; // View does not respond: crashes
//UIView *parent = self.view.superview;
//[parent setCanCancelContentTouches:YES]; // UIView does not respond
//UIScrollView * parentScrollView = (UIScrollView*)self.superview; // Superview not in structure
} else {
NSLog(@"normal shit");
}
}
So now I can detect when the user is touching the safety area UIview by testing for it's class 'MyView' but I can't work out how to either tell the parent UIScrollView to abort or just the touch there and then
Put a transparent UIButton behind the UISlider. The button will "eat" the touches and prevent scrolling.