0

我想要在我的应用程序中进行过渡,就像旧史酷比卡通中的神秘旋转墙一样。我希望屏幕在切换视图时旋转。有人为我指出正确的方向以实现这一目标吗?

4

2 回答 2

2

或者这个,它使用更少的墨水:

UIView *bookCaseView;    // this is the container... the haunted wall
UIView *booksView;       // just an ordinary set of books, right?
UIView *spookyBackside;  // ruh-roh, raggy!

[UIView transitionWithView:containerView
           duration:0.2
           options:UIViewAnimationOptionTransitionFlipFromLeft
           animations:^{
               [booksView removeFromSuperview];
               [bookCaseView addSubview:spookyBackside]; }
           completion:NULL];
于 2012-05-06T00:58:11.187 回答
0

我认为这就是你要找的:

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.0];

//optional if you want to do something after the animation
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(myAnimationDidFinish:finished:context:)];
//

[view2 setFrame:CGRectMake(0, 0, view2.frame.size.width, view2.frame.size.height)];
[view1 addSubview:view2];

[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:view1 cache:YES];
[UIView commitAnimations];

并翻转:

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.0];

//optional if you want to do something after the animation
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(myOtherAnimationDidFinish:finished:context:)];
//

[view2 removeFromSuperview];

[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:view1 cache:YES];
[UIView commitAnimations];
于 2012-05-06T00:37:14.777 回答