[[event allTouches] anyObject];
is fetching you only one of the touches.
you need to iterate over all the touches like so:
- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
int touch1 = 0;
int touch2 = 0;
NSArray *touches = [[event allTouches] allObjects];
for( UITouch *touch in touches ) {
CGPoint touchLocation = [touch locationInView:self.view];
NSLog(@"cgpoint:%f,%f", touchLocation.x, touchLocation.y);
if (CGRectContainsPoint(view1.frame, touchLocation)){
NSLog(@"TOUCH VIEW 1");
touch1 += 1;
NSLog(@"TOTAL TOUCH 1:%d", totalTouch1);
}
else if (CGRectContainsPoint(view2.frame, touchLocation)){
NSLog(@"TOUCH VIEW 2");
touch2 += 1;
NSLog(@"TOTAL TOUCH 2:%d", totalTouch2);
}
}
NSLog(@"Total touches on view 1: %d", touch1);
NSLog(@"Total touches on view 2: %d", touch2);
}