2012-02-25 92 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