【发布时间】:2011-02-10 20:32:39
【问题描述】:
可能重复:
iPhone CATransition adds a fade to the start and end of any animation?
我正在尝试复制 [UIViewController presentModalViewController:animated:] 执行的“从底部向上滑动”动画,但没有调用它,因为我不想要模态视图。
下面的核心动画代码非常接近,但似乎正在改变视图的透明度值。在动画开始时,您可以通过向上滑动的视图部分看到。在动画的中间/结束时,我们正在滑动的视图是完全透明的,因此我们可以看到它的后面。我希望在此动画期间两者都保持完全不透明。
关于如何停止此代码中的透明度更改或以其他方式获得我正在寻找的“向上滑动动画”而不需要模式视图的任何想法?
UIViewController *nextViewController = [[UIViewController alloc] autorelease];
nextViewController.view.backgroundColor = [UIColor redColor];
CATransition *animation = [CATransition animation];
animation.duration = 3.5;
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
animation.type = kCATransitionPush;
animation.subtype = kCATransitionFromTop;
[self.navigationController pushViewController:nextViewController animated:NO];
[self.navigationController.view.layer addAnimation:animation forKey:nil];
【问题讨论】:
标签: iphone objective-c uiviewcontroller uinavigationcontroller core-animation