Allow user interaction for the UIView PART during animation

I know that the user interaction issue for UIView during the animation was questioned, but I would like to know if it was possible to determine if there was a touch for a specific part of the entire UIView.

To get started, my animation code in a UIView:

[UIView animateWithDuration:15.0 delay:0.0 options:(UIViewAnimationOptionCurveEaseIn | UIViewAnimationOptionAllowUserInteraction) animations:^{
            self.frame = FINAL_RECT;
        } completion:^(BOOL finished) {
            [self removeFromSuperview];
        }];

Hit detection on viewController:

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    UITouch *touch = [touches anyObject];
    CGPoint touchPoint = [touch locationInView:self.view];

    BulletView *aBullet;
    for (aBullet in bulletArray) { //bulletArray contains the animating UIViews
        if ([[aBullet.layer presentationLayer] hitTest:touchPoint])
        {
            break;
        }
    }

    [aBullet.layer removeAllAnimations];
    [aBullet removeFromSuperview];
    [bulletArray removeObject:aBullet];

}

The logic is that the view is deleted on successful hit. This works fine, but the problem for me is [[aBullet.layer presentationLayer] hitTest:touchPoint]looking at the entire UIView, while I need to see if the user clicked a specific area inside the whole view. Something like that:

enter image description here

touchPoint UIView, , , , ​​() .

? .

UPDATE: , (a) (b) , ( ), . , , ( ), , - . !

+4

All Articles