2013-06-04 8 views
1

메인보기에 추가 된 UIView 유형의 하위보기가 4 개 있습니다. 나는 부드럽게 플립 애니메이션과 함께 이러한 전망을 반전하고 싶습니다. 시도했지만 성공적으로 완료 할 수 없습니다. 여기 제가 사용했던 코드가 있습니다.보기 내에서 ios에서 플립 애니메이션을 만드는 방법

[UIView beginAnimations:nil context:NULL]; 
[UIView setAnimationDuration:0.5]; 
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:signUpView cache:YES]; 
[UIView commitAnimations]; 

그것은 절반을 화나게하고 신속하게 다른보기를 표시합니다. 이 방법에 대해 알려주십시오. 시작 메신저에서

+0

http://stackoverflow.com/questions/ 17272179/how-can-i-create-vertical-flip-view-animation-in-ios/17342105 # 17342105 – Pradeep

답변

-1

별도로 각 뷰를 뒤집기 시도 그 후

[self.containerView addSubview:firstView]; 

을 containerView에 추가. 이

[UIView beginAnimations:nil context:NULL]; 
[UIView setAnimationDuration:0.5]; 
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:signInView cache:YES]; 
[UIView commitAnimations]; 
// 
[UIView beginAnimations:nil context:NULL]; 
[UIView setAnimationDuration:0.5]; 
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:signUpView cache:YES]; 
[signInView setHidden:YES];//or you can use remove subview 
[signUpView setHidden:NO];// you can use addsubview 
[UIView commitAnimations]; 
+0

'beginAnimations :''commitAnimations :'는 만났습니다. iOS4 이후 UIView 애니메이션의 hod가 더 이상 사용되지 않으므로 대신 블록 기반 애니메이션 방법을 사용하는 것이 좋습니다. – Abizern

3

내 firstView 당신이 당신에게 플립 전환을 추가 할 필요가 어디

[UIView transitionWithView:self.containerView 
        duration:1 
        options:UIViewAnimationOptionTransitionFlipFromRight 
       animations:^{ [firstView removeFromSuperview]; [self.containerView addSubview:secondView]; } 
       completion:NULL]; 
3

심지어이

CATransition *animation = [CATransition animation]; 
    animation.delegate = self; 
    animation.duration = 1; 
    animation.timingFunction = UIViewAnimationCurveEaseInOut; 
    animation.fillMode = kCAFillModeForwards; 
    animation.endProgress = 1; 
    animation.removedOnCompletion = NO; 
    animation.type = @"oglFlip"; 

    [yourView.layer addAnimation:animation forKey:@"animation"]; 

에게 좀 더 애니메이션 형식을 시도 할 수 있습니다 어쩌면처럼 당신이 원하는 경우 :

animation.type = @"cube"; 
animation.type = @"suckEffect"; 
animation.type = @"suckEffect"; 
animation.type = @"pageCurl"; 
animation.type = @"pageUnCurl"; 
animation.type = @"cameraIrisHollowOpen "; 
animation.type = @"cameraIrisHollowClose ";