I\'m working on an iPhone game whose code I inherited from another developer. The gaming grid is a UIScrollView having a contentSize of 1000x1000. The grid co
I had exactly the same problem (and wasted a lot of time).
Then I tried to set the cancelsTouchesInView
property as soon as possible (I did it in viewDidLoad
)... and it worked for me (as shown here)!
- (void)viewDidLoad {
[super viewDidLoad];
/* other initializations */
scrollView.panGestureRecognizer.cancelsTouchesInView = NO;
}
This works in iOS 5. Before iOS 5 you need to go through all the recognizers, find the panGestureRecognizer, and then set the property. So this should be a universal solution:
- (void)viewDidLoad {
[super viewDidLoad];
/* other initializations */
for (UIGestureRecognizer *gesture in scrollView.gestureRecognizers){
if ([gesture isKindOfClass:[UIPanGestureRecognizer class]]){
gesture.cancelsTouchesInView = NO;
}
}