이것은 내가 지금까지 가지고있는 것입니다. 내가 뭘 하려는지 시작보기 (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];
presentModalViewController : animated : 잠재적으로 새 뷰를 이전 뷰 위에 배치합니까? 또한,보기를 제시하고 그보기를 삽입하는 것은 다소 '해킹 된 것 같습니다. –