2012-04-26 7 views
0

이것은 내가 지금까지 가지고있는 것입니다. 내가 뭘 하려는지 시작보기 (startUpView) 다른보기 (creatNewGameViewController) 새보기 화면 아래로 슬라이드하여 전환 할 수 있습니다. 이제는 일반적으로 뷰를 전환하는 것이지만 실제로 슬라이딩 효과를 원합니다. 누구든지 내 코드에서 오류를 발견 할 수 있다면 많은 도움이 될 것입니다. 감사합니다UIView 애니메이션 스왑보기 (아래로 슬라이드)

#import "CreateNewGameViewController.h" 
@synthesize createNewGameViewController; 
UIButton *mainCreateGame = [UIButton buttonWithType:UIButtonTypeRoundedRect]; 
[mainCreateGame addTarget:self 
        action:@selector(goToCreateGameViewController) 
     forControlEvents:UIControlEventTouchUpInside]; 
[mainScroll addSubview:mainCreateGame]; 
mainCreateGame.frame = CGRectMake(65, 10, 190, 60); 

-(void)goToCreateGameViewController{ 
CreateNewGameViewController *newGame = [[CreateNewGameViewController alloc]initWithNibName:@"CreateNewGameViewController" bundle:nil]; 
self.createNewGameViewController = newGame; 

CATransition *transition = [CATransition animation]; 
transition.duration = 2; 
transition.timingFunction = [CAMediaTimingFunction  
          functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; 
transition.type =kCATransitionMoveIn; 


CATransition *transition1 = [CATransition animation]; 
transition1.duration = 2; 
transition1.timingFunction = [CAMediaTimingFunction  
          functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; 
transition1.type =kCATransitionMoveIn; 
transition1.subtype =kCATransitionFromTop; 

transition1.delegate = self; 

[createNewGameViewController.view.layer addAnimation:transition1 forKey:nil]; 
transition1.subtype =kCATransitionFromTop; 

transition1.delegate = self; 



[self presentModalViewController:newGame animated:NO]; 
[self.view insertSubview:newGame.view atIndex:0]; 

[createNewGameViewController.view.layer addAnimation:transition1 forKey:nil]; 

[newGame release]; 
+0

presentModalViewController : animated : 잠재적으로 새 뷰를 이전 뷰 위에 배치합니까? 또한,보기를 제시하고 그보기를 삽입하는 것은 다소 '해킹 된 것 같습니다. –

답변

0

의 UIView 당신이 정말로해야, 그것은 :) 조언

UiView

한 조각 얼마나 애니메이션 볼 수있는보기에서 전환이라는 클래스의 방법이 도움이 있는지 확인하고 말해있다 할 수있는 적절한 방법이기 때문에 그러한 종류의 뷰 전환을 수행하기 위해 탐색 컨트롤러, 스토리 보드 또는 이와 유사한 것을 사용하십시오.

+0

무엇을 의미합니까? 이 물건에 새로운 임 그래서 내가 무엇이 (또는 왜) 내가이 물건 롤의 절반을 사용해야하는지 확실히 모르겠다. – nfoggia

+0

ios sdk는 MVC를 지향하고있다. –