我有一个Iphone应用程序,其中我想在我的splashview中实现flipanimation,就像在PATH Application中一样。我使用seperte viewcontroller来呈现我的splashview。我想用这个动画从窗口中删除它。可以任何人都知道如何实现这一点。这就是我正在做的添加视图。如何从窗口中删除此视图并添加动画像“
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.startupController = [[StartupViewController alloc] initWithNibName:@"StartupViewController" bundle:nil];
[window addSubview:self.startupController.view];
[self.startupController.activityIndicator setHidden:NO];
[self.startupController.activityIndicator startAnimating];
[window makeKeyAndVisible];
timer = [NSTimer scheduledTimerWithTimeInterval: 2.0
target: self
selector: @selector(handleTimer:)
userInfo: nil
repeats: NO];
// [window addSubview:navigationController.view];
// [window makeKeyAndVisible];
return YES;
}
-(void)handleTimer:(NSTimer*)timer {
[self.startupController.activityIndicator stopAnimating];
[self.startupController.activityIndicator setHidden:YES];
self.startupController.view.layer.anchorPoint=CGPointMake(0, .5);
self.startupController.view.center = CGPointMake(self.startupController.view.center.x - self.startupController.view.bounds.size.width/2.0f, self.startupController.view.center.y);
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:5];
[UIView setAnimationDelay:1];
self.startupController.view.transform = CGAffineTransformMakeTranslation(0,0);
CATransform3D _3Dt = CATransform3DIdentity;
_3Dt =CATransform3DMakeRotation(3.141f/2.0f,0.0f,-1.0f,0.0f);
_3Dt.m34 = 0.001f;
_3Dt.m14 = -0.0015f;
self.startupController.view.layer.transform =_3Dt;
[UIView commitAnimations];
//[window addSubview:navigationController.view];
//[window makeKeyAndVisible];
}
`when i am doing like this i can have that flip animation.but when the view is flipping i need to have my home view there.But when i am uncomenting the last two lines that functionality is working but there is no animation.Can anybody help me?
答案 0 :(得分:1)
我喜欢this post中使用的方法。虽然那里使用的动画有褪色,但它是动画的好容器。
如果你也设置了animationTransition,你应该能够获得你想要的动画。像这样......
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:splashView cache:YES];
这至少应该让你开始。 : - )
答案 1 :(得分:1)
这是我已经在我的一个项目中使用过的一个代码。
我需要像打击垫一样打开封面。
#pragma mark Open Book Animation
- (void)pageOpenView:(UIView *)viewToOpen duration:(NSTimeInterval)duration {
// first add next view below current view
[self.view.window insertSubview:navigationController.view
belowSubview:self.view];
// set anchor point for the view animation
viewToOpen.layer.anchorPoint = CGPointMake(0.0f, 0.0f);
viewToOpen.center = CGPointMake(0,
(viewToOpen.center.y -
(viewToOpen.bounds.size.height/2.0f)));
// start the Page Open
[UIView beginAnimations:@"Page Open" context:nil];
[UIView setAnimationDuration:2.0];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(didEndAnimation)];
[viewToOpen.layer setValue:[NSNumber numberWithInt:180]
forKeyPath:@"transform.rotation.x"];
[splashImageView setHidden:YES];
[UIView commitAnimations];
}
这里viewToOpen是需要动画的UIView,持续时间是动画的时间线。
希望这是你所需要的。
享受编码:)