cho*_*ise 4 iphone animation uiviewcontroller uinavigationcontroller ios
以下情况.我有一个使用UINavigationController进行导航的应用程序.
对于推送特殊导航控制器,我想要一个自定义动画,缩小.我到目前为止看起来很好,唯一的问题是,"旧的"Viewcontroller在动画开始之前就消失了,所以新的viewcontroller缩小了"nothing"而不是在后台查看旧的viewcontroller.
为了更好地观看我创建了一个简单的示例应用程序:下载



有没有人知道,如何动画新的视图控制器(image3),旧的视图控制器(image1)在动画(图像2)时留在后台?
/* THIS CANNOT BE CHANGED */
AnimatedViewController *animatedViewController = [[AnimatedViewController alloc] initWithNibName:@"AnimatedViewController" bundle:nil];
/* THIS CAN BE CHANGED */
animatedViewController.view.transform = CGAffineTransformMakeScale(0.01, 0.01);
[UIView beginAnimations:@"animationExpand" context:NULL];
[UIView setAnimationDuration:0.6f];
animatedViewController.view.transform=CGAffineTransformMakeScale(1, 1);
[UIView setAnimationDelegate:self];
[UIView commitAnimations];
/* THIS CANNOT BE CHANGED */
[self.navigationController pushViewController:animatedViewController animated:NO];
Run Code Online (Sandbox Code Playgroud)
其他信息:我的应用程序并不那么简单.我为我的应用程序使用了three20框架,但视图控制器的推送和创建就是three20所做的.我只能挂钩(THIS CAN BE CHANGED在我的代码中)之间的部分.我无法在此之前和之后更改代码(除非经过大量研究).
我很快就把它鞭打了.我们的想法是在缩放动画完成后调用pushViewController.
-(IBAction)animateButtonClicked:(id)sender {
animatedViewController = [[AnimatedViewController alloc] initWithNibName:@"AnimatedViewController" bundle:nil];
animatedViewController.view.transform = CGAffineTransformMakeScale(0.01, 0.01);
[UIView animateWithDuration:0.6
animations:^{
[self.view addSubview:animatedViewController.view];
animatedViewController.view.transform=CGAffineTransformMakeScale(1, 1);
}
completion:^(BOOL finished){
[animatedViewController.view removeFromSuperview];
[self.navigationController pushViewController:animatedViewController animated:NO];
}];
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2709 次 |
| 最近记录: |