I have a UIScrollView with the requirement that contentSize.height remains the same when scaling. Scaling from 200x100 should lead to the creation of a new contentSize 400x100 instead of 400x200, for example. I would like to make my own drawing while the user zooms out.
I do not think that I can use the usual scalable behavior of UIScrollView to achieve this, so I am trying to collapse myself. (I could just let this do my job and then redraw my content when -scrollViewDidEndZooming: withView: atScale: gets a call, but that would not be very pretty).
I am currently subclassing UIScrollView and trying to do my own scaling when two fingers are on the screen:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
if ([touches count] != 2) {
[super touchesMoved:touches withEvent:event];
} else {
}
}
I thought that redefining the touches of Began: withEvent :, touchhesMoved: withEvent :, touchesEnded: withEvent: and touchesCancelled: withEvent: should work this way, but it doesn't.
The earlier unsuccessful attempt was to put a transparent view on top of the scroll and send touches that didn't interest me to scroll:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
if ([touches count] != 2) {
[self.theScrollView touchesMoved:touches withEvent:event];
} else {
}
}
Any help would be appreciated.
Thank you Thomas
source
share