2012-02-25 116 views
0

我基本上一个接一个地运行两个动画,并且它似乎以某种方式干扰了彼此或UIView。我的代码在5.0模拟器上工作得很好,但在4.3模拟器中遇到问题。动画块互相干扰

基本上我在屏幕上有一堆图像。

[UIView animateWithDuration:0.1f 
          delay:0.0f 
         options:UIViewAnimationOptionCurveEaseIn 
        animations:^(void) { 
         //resizing the frame to make it bigger (original size is the new bigger size) 
         self.frame = CGRectMake(point.x - originalSize.width/2, point.y - originalSize.height/2 , originalSize.width, originalSize.height); 

        } 
        completion:^(BOOL complete){ 
         //I have a showArrow method that draws an arrow to the superview to show the user where to place their image 
         [self performSelector:@selector(showArrow) withObject:nil afterDelay:1]; 
        }]; 

一旦该块完成,它运行showArrow,这只是显示一个跳跃箭头:

[UIView animateWithDuration:0.5f 
          delay:0.0f 
         options:UIViewAnimationOptionAutoreverse | UIViewAnimationOptionRepeat 
        animations:^(void) { 
         self.arrow.frame = CGRectMake(arrowOrigin.origin.x, arrowOrigin.origin.y - 200, arrow.frame.size.width, arrow.frame.size.height); 
         self.arrow.alpha = 0.5; 
        } 
        completion:NULL]; 

所以,正如我所说,这个作品当对象被触动,它在尺寸可扩展至完美地在我的iPad和5.0模拟器上,但在4.3中,一旦第一个动画运行,它似乎冻结了图像的平移手势或被触摸的能力。任何想法,这与什么呢?由于

回答

2

尝试添加UIViewAnimationOptionAllowUserInteraction面具的选项参数

[UIView animateWithDuration:0.1f 
         delay:0.0f 
        options:UIViewAnimationOptionCurveEaseIn | 
          UIViewAnimationOptionAllowUserInteraction 
       animations:^(void) { 
       // ... 

而且在showArrow

[UIView animateWithDuration:0.5f 
         delay:0.0f 
        options:UIViewAnimationOptionAutoreverse | 
          UIViewAnimationOptionRepeat | 
          UIViewAnimationOptionAllowUserInteraction 
       animations:^(void) { 
       // ... 
+0

非常感谢你,这个固定的问题! – user339946 2012-02-25 08:41:53