我想动画一个UIImageView&在动画中我想识别它上面的事件

时间:2012-10-17 10:58:18

标签: iphone objective-c ios xcode

当动画UIImageView时,它不会在动画期间发送事件,但是当它完成动画时,那时它能够发送事件,我也尝试了UIButton。

2 个答案:

答案 0 :(得分:1)

在调用动画时,您只需要包含UIViewAnimationOptionAllowUserInteraction选项:

[UIView animateWithDuration:animationDuration 
                          delay:0 
                        options:(UIViewAnimationOptionCurveLinear | UIViewAnimationOptionAllowUserInteraction)
                     <snip>];

答案 1 :(得分:0)

    CATransition *animation = [CATransition animation];
    [animation setDelegate:self];   
    [animation setType:kCATransitionFade];
    [animation setDuration:0.0];// try 0.1 also
    [animation setTimingFunction:[CAMediaTimingFunction functionWithName:
                                  kCAMediaTimingFunctionEaseInEaseOut]];
    [[yourImageView layer] addAnimation:animation forKey:@"transitionViewAnimation"];//Try   self.view insted of yourImageView if you want to animate whole view