2012-12-20 3 views
2

가능한 중복 : 나는 버튼과 같은 역할을하는 이미지 뷰, 나는 사용자를 표시 할 수있는 방법을 찾고있다
How to use CGAffineTransformMakeRotation?애니메이션, 멋진 작은 파열

그가 그것을 클릭했다면, 조금 돌아가는이 코드를 생각해 냈습니다.

float angle = 60.0; 
[UIView animateWithDuration:0.5f animations:^{ 
    customimageView.transform = CGAffineTransformMakeRotation(angle); 
}]; 

내가 바라는 행동을하지 않는 것. 누구나 클릭 한 번으로 이미지를 확대 (또는 확대/확대) 할 수있는 방법을 알 수 있습니까? 여기에 어떤 종류의 애니메이션이 관련되어 있습니까? 이 상황에서 멋진 사람이라고 생각하는 행동을 자유롭게 공유하십시오.

감사합니다.

보조 메모로 어떻게 전체 원형을 회전시킬 수 있습니까? 나는 360에 통과하려고 노력했다. 그러나 그것을하지 않고있다?

답변

2

당신은 항상 CGAffineTransformMakeScale로 만든 스케일링 변환, 당신의 회전을 CGAffineTransformConcat 수 있습니다.

BOOL keepThrobbing = NO; 

-(void)buttonThrob:(CGFloat)inset { 

    UIViewAnimationOptions opts = UIViewAnimationOptionBeginFromCurrentState|UIViewAnimationOptionAllowUserInteraction; 

    [UIView animateWithDuration:0.2 delay:0.0 options:opts animations:^{ 
     self.button.frame = CGRectInset(self.button.frame, inset, inset); 
    } completion:^(BOOL finished) { 
     [UIView animateWithDuration:0.2 delay:0.0 options:opts animations:^{ 
      self.button.frame = CGRectInset(self.button.frame, -inset, -inset); 
     } completion:^(BOOL finished) { 
      if (finished && keepThrobbing) { 
       [self buttonThrob:inset]; 
      } 
     }]; 
    }]; 
} 

과 같이 호출 :

keepThrobbing = YES; 
[self buttonThrob:10.0]; // expand/shrink by 10px in x and y 
당신이 효과를 누르면 다른 버튼에 관심이 있다면 다음과 같이

는, 나도 뭔가 멋진 필요하고, "두근 두근"애니메이션에 정착

0

스케일을 변경하려면 CGAffineTransformMakeScale을 사용하십시오.

CustomimageView.transform = CGAffineTransformMakeScale (1.5,1.5);

0

당신은이 아핀을 결합 할 수는 CGAffineTransformConcat로 변환 :

[customimageView setTransform:CGAffineTransformConcat(CGAffineTransformMakeScale(1.5, 1.5), CGAffineTransformMakeRotation(angle))]; 
+0

내 중복 게시물을 발견해 주셔서 감사합니다, 나는 그것을 삭제했습니다. 어떻게 된 일인지 잘 모르겠다. 나는 사소한 편집을 의도했다. – danh