When I use :
CALayer *hitLayer =
[[self.view.window.layer presentationLayer] hitTest:pointOfTouch];
I then explore the layer to discover that all the property that are animating at the moment are set to their final states.
The layer I'm testing on is the CALayer of an UIImageView in iOS 4.3. I also have an IBOutlet to that UIImage view. So I did the same test like this:
CALayer *l = [self.topLeft.layer presentationLayer];
NSLog(@"presentation layer frame for eloise is : %@", [self cgRectDescription:l.frame]);
NSLog(@"and xPosition = %.2f, yPosition = %.2f & zPosition = %.2f", l.position.x, l.position.y, l.zPosition);
And I still get the same result.I'm testing this in (void)touchesBegan:withEvent: while the image is moving.
Here is the animation I'm using
[UIImageView animateWithDuration:aDuration
delay:0
options:UIViewAnimationOptionCurveEaseIn | UIViewAnimationOptionAllowUserInteraction | UIViewAnimationOptionBeginFromCurrentState
animations:^(void) {
aIv.center = imageStartingPoint;
aIv.layer.zPosition = 0;
imageStartingPoint = CGPointZero;
centerImage = nil;
CABasicAnimation *ba = [CABasicAnimation animationWithKeyPath:@"shadowOffset"];
ba.fromValue = [NSValue valueWithCGSize:aIv.layer.shadowOffset];
ba.toValue = [NSValue valueWithCGSize:CGSizeMake(0, 0)];
aIv.layer.shadowOffset = CGSizeMake(0, 0);
ba.duration = aDuration;
ba.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
[aIv.layer addAnimation:ba forKey:@"shadowOffset"];
ba = [CABasicAnimation animationWithKeyPath:@"shadowRadius"];
ba.fromValue = [NSNumber numberWithFloat:aIv.layer.shadowRadius];
ba.toValue = [NSNumber numberWithFloat:0];
aIv.layer.shadowRadius = 0;
ba.duration = aDuration;
ba.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
[aIv.layer addAnimation:ba forKey:@"shadowRadius"];
}
completion:NULL]; </pre> </code>
It's probably a little simple thing, but I'm out of idea, thanks,