
animateFirstTouchAtPoint
By: a guest on
Aug 2nd, 2012 | syntax:
Objective C | size: 0.96 KB | hits: 17 | expires: Never
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
// We only support single touches, so anyObject retrieves just that touch from touches
UITouch *touch = [touches anyObject];
/// Animate the first touch
CGPoint touchPoint = [touch locationInView:myParentView];
//started animating
[self animateFirstTouchAtPoint:touchPoint];
}
- (void)animateFirstTouchAtPoint:(CGPoint)touchPoint {
#define GROW_ANIMATION_DURATION_SECONDS 0.15
NSValue *touchPointValue = [NSValue valueWithCGPoint:touchPoint];
[UIView beginAnimations:nil context:(__bridge_retained void *)touchPointValue];
[UIView setAnimationDuration:GROW_ANIMATION_DURATION_SECONDS];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(growAnimationDidStop:finished:context:)];
CGAffineTransform transform = CGAffineTransformMakeScale(1.2f, 1.2f);
self.transform = transform;
[UIView commitAnimations];
touchPointValue = nil;
}