view 1 is current view
view 2 is view to push
是否有可能
view 1 draw at top layer
view 2 draw at bottom layer
将视图1向下移动到屏幕外,同时将CGAffineTransformMakeScale视图从0.1移动到1.0
我该怎么做?
更新
我想将所有屏幕(包括navigationController)移动到屏幕底部。 那么我的问题是当我在navigationController上绘制这个图层时 在我移动navigationController之后,这个层都将坚持使用navigationController
如何对navigationController后面的viewTopush(View 2)进行临时视图并进行动画处理
这是我的代码,但它还没有用。
RO_GALViewController *galView = [[RO_GALViewController alloc] initWithNibName:@"RO_GALViewController" bundle:nil];
UINavigationController* navigationController;
CGRect frame;
navigationController = [self navigationController];
frame = [navigationController.view convertRect:self.view.frame fromView:self.view.superview];
galView.view.frame = frame;
galView.view.transform = CGAffineTransformMakeScale(0.1,0.1);
galView.view.alpha = 0;
UIView *blackView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
blackView.backgroundColor = [UIColor blackColor];
blackView.alpha = 0;
[[self navigationController].view addSubview:blackView];
[[self navigationController].view addSubview:galView.view];
[navigationController.view bringSubviewToFront:self.view];
[UIView animateWithDuration:1.3f
delay:0.0f
options:UIViewAnimationCurveEaseInOut
animations:^{
galView.view.alpha = 1.0f;
galView.view.transform = CGAffineTransformMakeScale(1.0f, 1.0f);
navigationController.view.frame = CGRectMake(self.view.frame.origin.x, 460, self.view.frame.size.width, self.view.frame.size.height);
} completion:^(BOOL finished) {
[[self navigationController] pushViewController:galView animated:NO];
}];
答案 0 :(得分:1)
将两个动画放在beginAnimations / commitAnimations代码部分中。它将同时进行动画制作。您不必担心图层。
答案 1 :(得分:1)
您添加到此问题(uinavigationcontroller
和pushviewcontroller
)的标记表明您正在讨论在屏幕上推送新的视图控制器,但您的说明听起来像两个视图都是两个子视图包含在同一视图控制器中......
您可以轻松地将UIStoryboardSegue子类化以创建自己的动画。在您的情况下,您将向下更改源视图控制器视图的位置,并应用(和动画)目标视图控制器视图的变换。动画本身就像任何其他动画一样。
做两个动画。您可以使用UIView动画轻松地同时执行这两项操作,例如
view2.transform = CGAffineTransformMakeScale(0.1, 0.1); // the "from" value
[UIView animateWithDuration:2.0 // animate for 2 seconds
animations:^{
view1.center = view1.center + theDistanceItShouldMoveDown;
view2.transform = CGAffineTransformIdentity; // no scale
}];