2013-01-22 1 views
0
[sourceViewController.view addSubview:destinationController.view]; 
[destinationController.view setFrame:sourceViewController.view.window.frame]; 
[destinationController.view setTransform:CGAffineTransformMakeScale(0.5,0.5)]; 
[destinationController.view setAlpha:0.0]; 

[UIView animateWithDuration:0.3 
         delay:0.0 
        options:UIViewAnimationCurveEaseOut 
       animations:^{ 
        [destinationController.view setTransform:CGAffineTransformMakeScale(1.0,1.0)]; 
        [destinationController.view setAlpha:1.0]; 
        //[sourceViewController.view setAlpha:0]; 
       } 
       completion:^(BOOL finished){ 
        [destinationController.view removeFromSuperview]; 
        [sourceViewController.navigationController pushViewController:destinationController animated:NO]; 
       }]; 

내 destinationController에는 2 개의보기가 하나씩 있습니다. 보기 # 1은 기본보기이며 완전히 표시되고보기 # 2는 반은 보이지 않는 절반으로 숨겨집니다. 위의 코드를 사용하고 각 뷰 사이를 이동하면 (Alpa 0에서 1로 이동하면서) 숨겨진 뷰가 주 뷰 아래에 완전히 표시됩니다. 따라서 사용자는 그 아래에 숨겨져있는 것을 볼 수 있습니다. (비록 내가 심지어 animateWithDuration을 정말로 빨리 만들었다 고해도). 왜 이런 일이 일어나고 창의적인 솔루션을 찾으려고 노력하는지 모르겠습니다. 한 가지 해결책은 내가 ViewController기본보기 아래의 절반 숨겨진보기가 알파 섹터에 표시됩니다.

[UIView animateWithDuration:0.7 animations:^() {_image.alpha = 1;}]; 

내부에 의해 애니메이션을 사용 해낸 그 숨겨진보기 "둔화"하지만, 분명히보기는 지연에로드되어 보이는 부분에 이렇게 우아한 보이지 않는다 숨겨진보기의.

감사

답변

1
당신은 당신의 애니메이션을하기 전에, 또는 같은에서 0으로 실행이 애니메이션에 숨겨진 뷰의 알파를 설정 (동시 실행) 다른 애니메이션을 설정, 먼저 부분적으로 숨겨진보기를 숨길 수

또는 기본보기 애니메이션보다 빠른 속도.

관련 문제