2011-10-01 2 views
0

나는 전화 번호를 부를 때 볼 수있는 것과 동일한 효과를 내기 위해 많은 노력을 기울였습니다. 정면보기는 확대/축소 효과로 사라지고 다른 하나는 줌 효과와 함께 나타납니다.전화 걸기와 같이 두 가지보기 애니메이션하기

나는 그 효과를 달성 할 수 없다. 항상 그렇다. 불투명도에 대한 조치와 함께 규모 효과가있는 것 같습니다. 그러나 ...

그 효과를 반영하기 위해 어떻게 수행 할 수 있는지 알고 있습니까 (그렇게 많은 것은 아닙니다).

답변

-1
// Make this interesting. 

[UIView beginAnimations:nil context:nil]; 
[UIView setAnimationDuration:2.0]; 
[UIView setAnimationTransition:UIViewAnimationTransitionNone forView:self.view cache:YES]; 
[UIView setAnimationDelegate:self]; 
[UIView setAnimationDidStopSelector:@selector(startupAnimationDone:finished:context:)]; 
self.view.alpha = 0.0; 
self.view.frame = CGRectMake(self.view.center.x,self.view.center.y , 0, 0); 
[UIView commitAnimations]; 
} 

더 나은 애니메이션을위한 프레임 워크라고 생각합니다. 그것은 작동 보장되지는 않지만, 전환의 첫 번째 부분에 대해 내가 생각할 수있는 최선의 방법입니다.

이렇게하면보기 컨트롤러의보기 프레임이 변경되어 자연스러운 검정색 인 화면 중앙으로 "빨아들"수 있습니다. 이제는 CGAffineTransform이 훨씬 더 쉬워 졌을 것입니다 ...

EDIT (보행 보조 용) : iOS 4부터는 더 새롭고 구문 론적으로 깨끗한 애니메이션 블록과 좋은 변형 :

[UIView animateWithDuration:0.25 delay:0.0 options:0 animations:^{ 
    //animate the toolbars in from the top and bottom 
    [myTopView setFrame:CGRectMake(0, self.view.frame.size.height - 44, self.view.frame.size.width, 44)]; 
    [myBottomView setFrame:CGRectMake(0, 0, self.view.frame.size.width, 44)]; 
    //fade to black... 
    self.view.alpha = 0.0; 
    //and suck inwards. 
    self.view.frame = CGRectMake(self.view.center.x,self.view.center.y , 0, 0); 
} 
completion:^{ 
    //do something to end nicely, or start another animation block. 
}]; 
+0

내가 왜 최상 답변인가, 투표 대상이되는 것입니까? – CodaFi

+0

아마도 답변이 효과가 있었기 때문에 잘 설명되지 않았습니다 ... –

+0

Aw, lighten up, mon frere. 나는 어렸을 때 이것을 게시했습니다. 나는 그것을 즉시 편집 할 것이다. – CodaFi

관련 문제