2014-01-06 2 views
0

감소 도면의 작은 클립 날 애니메이션되는 출발 :있는 UIButton의 애니메이션 여기 크기

Animation flash

enter image description here

I는 데 문제 때 애니메이션? S로 그리고 그 반대로 화면에서 벗어나 다른 크기에서 돌아가려면 적절한 프레임을 설정하고 있습니다. 블랙 버튼의 크기가 그 주위를 돌 때마다 줄어든 이유는 무엇입니까? 난 그냥 ... 솔직히 내가 읽기/코드/논리를 볼 수 없습니다 내 논리를 넣어하지만 당신에 대한 내 생각 일 수있다

-(void)moveToRight 
{ 
//just made this method up, but my actual code 
//special case 
if (currentDay == 7) { 
    //move off the screen to the right 
    CGRect offScreenRightFrame = CGRectMake(self.circle.frame.origin.x + 60, self.circle.frame.origin.y, self.circle.frame.size.width, self.circle.frame.size.height); 
    //move to the left of the screen so we can animate it in 
    CGRect offScreenLeftFrame = CGRectMake(-40, self.circle.frame.origin.y, self.circle.frame.size.width, self.circle.frame.size.height); 

    if (self.delegate) { 
     if ([self.delegate respondsToSelector:@selector(dayChangedTo:)]) [self.delegate dayChangedTo:[self getCurrentDay]]; 
    } 

    [self pulseCircle]; 
    [UIView animateWithDuration:0.25f delay:0.0f options:UIViewAnimationOptionCurveLinear animations:^{ 
     self.circle.frame = offScreenRightFrame; 
    }completion:^(BOOL finished) { 
     if (finished) { 
      self.circle.alpha = 0.0f; 
      self.circle.frame = offScreenLeftFrame; 
      [UIView animateWithDuration:0.25f delay:0.0f options:UIViewAnimationOptionCurveLinear animations:^{ 
       self.circle.center = self.labelSun.center; 
       self.circle.alpha = 1.0f; 
      }completion:^(BOOL finished) { 
       if (finished) { 
        [UIView animateWithDuration:0.25f animations:^{ 
         [self changeColors]; 
         [self pulseCircle]; 
        }]; 
       } 
      }]; 
     } 
    }]; 
} 

-(void)moveLeft 
{ 
if (currentDay == 8) { 

    CGRect circleFrame = self.circle.frame; 

    CGRect offScreenLeft = CGRectOffset(circleFrame, -20, 0); 
    CGRect offScreenRightFrame = CGRectMake(self.labelQuestion.frame.origin.x + 30, self.labelQuestion.frame.origin.y, circleFrame.size.width, circleFrame.size.height); 

    [self pulseCircle]; 
    [UIView animateWithDuration:0.25f delay:0.0f options:UIViewAnimationOptionCurveLinear animations:^{ 
     self.circle.frame = frame; 
    }completion:^(BOOL finished) { 
     if (finished) { 
      self.circle.alpha = 0.0f; 
      self.circle.frame = frameFinal; 
      [UIView animateWithDuration:0.25f delay:0.0f options:UIViewAnimationOptionCurveLinear animations:^{ 
       self.circle.center = self.labelQuestion.center; 
       self.circle.alpha = 1.0f; 
      }completion:^(BOOL finished) { 
       if (finished) { 
        [UIView animateWithDuration:0.25f animations:^{ 
         [self changeColors]; 
         [self pulseCircle]; 
        }]; 
       } 
      }]; 
     } 
    }]; 
} 


- (void)pulseCircle 
{ 
__block UILabel *day = [self getLabelOfDay]; 
[UIView animateWithDuration:TRANLATE_DURATION/2 delay:0.0f options:UIViewAnimationOptionBeginFromCurrentState animations:^{ 
    self.circle.layer.transform = CATransform3DMakeScale(1.35f, 1.35f, 1); 
    day.transform = CGAffineTransformMakeScale(1.35f, 1.35f); 
}completion:^(BOOL finished) { 
     [UIView animateWithDuration:TRANLATE_DURATION/2 animations:^{ 
      self.circle.layer.transform = CATransform3DIdentity; 
      day.transform = CGAffineTransformIdentity; 
     }]; 
}]; 
} 
+0

self.circle.frame = frame .... 당신은 무엇을 선언 했습니까? – jailani

답변

0

는) 그래서, 나는 ... 당신이 원의 크기를 추가해야한다고 생각 공용 변수를 기본 크기로 사용합니다. 그리고 부자가 될 때마다이 크기를 설정하십시오. 17에 하루는 잘 작동하지만, 문제가에 생성하기 때문에

if (currentDay == 0 || currentDay == 8) 
{ 
    // Here you need to set your default size. 
} 

, 당신에 대한 내 논리 일 수 있음 때 0 또는 8일에서 currentDay 풍부.

고마워요 :)

관련 문제