Iphone 是否可以使用2层推送自定义动画?
有可能吗Iphone 是否可以使用2层推送自定义动画?,iphone,animation,uinavigationcontroller,pushviewcontroller,Iphone,Animation,Uinavigationcontroller,Pushviewcontroller,有可能吗 view 1 is current view view 2 is view to push 将视图1向下移动到屏幕外,同时将CGAffineTransformMakeScale视图2从0.1移动到1.0 我该怎么做 更新 我想将所有屏幕(包括navigationController)移动到屏幕底部。 然后我的问题是当我在navigationController上绘制这两个图层时 在我向下移动navigationController之后,这两个层都将使用navigationContro
view 1 is current view
view 2 is view to push
将视图1向下移动到屏幕外,同时将CGAffineTransformMakeScale视图2从0.1移动到1.0
我该怎么做
更新
我想将所有屏幕(包括navigationController)移动到屏幕底部。
然后我的问题是当我在navigationController上绘制这两个图层时
在我向下移动navigationController之后,这两个层都将使用navigationController
如何在navigationController后面创建viewTopush(视图2)的临时视图并制作动画
这是我的代码,但它还没有工作
view 1 draw at top layer
view 2 draw at bottom layer
只需将这两个动画放在beginAnimations/Committeanimations代码部分中。它将同时制作动画。您不必担心图层。您添加到此问题的标记(
uinavigationcontroller
和pushviewcontroller
)建议您正在谈论在屏幕上推送一个新的视图控制器,但您的描述使它听起来像两个视图都是包含在同一视图控制器中的两个子视图
如果正在推送新的视图控制器。。。
您可以轻松地将UIStoryboardSegue子类化以创建自己的动画。在本例中,您将向下更改源视图控制器视图的位置,并应用(并设置)目标视图控制器视图的变换。动画本身与任何其他动画一样
如果两个视图位于同一视图控制器内。。。
两个动画都要做。您可以使用UIView动画轻松地同时执行这两个操作,如下所示
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];
}];
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
}];