【发布时间】:2016-01-13 22:31:56
【问题描述】:
我目前正在尝试在两个视图控制器之间进行交互转换。这是一个被解雇的交互式动画。我使用UIPercentDrivenInteractiveTransition 的子类并执行在另一个对象动画器中实现的以下动画。
我没有成功进行插入toVC 视图的transform 属性的交互。
- (void) animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext
{
NSLog(@"Animate!!");
//Basic container
UIViewController *fromVC = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
UIViewController *toVC = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
fromVC.view.frame = [transitionContext initialFrameForViewController:fromVC];
toVC.view.frame = [transitionContext finalFrameForViewController:fromVC];
toVC.view.transform = CGAffineTransformMakeScale(0.9, 0.9);
//[transitionContext.containerView insertSubview:toVC.view belowSubview:fromVC.view];
NSTimeInterval duration = [self transitionDuration:transitionContext];
[UIView animateWithDuration:duration animations:^{
[fromVC beginAppearanceTransition:NO animated:YES];
fromVC.view.frame = CGRectMake(0, CGRectGetHeight(fromVC.view.frame), CGRectGetWidth(fromVC.view.frame), CGRectGetHeight(fromVC.view.frame));
toVC.view.transform = CGAffineTransformIdentity;
[toVC beginAppearanceTransition:YES animated:YES];
} completion:^(BOOL finished){
[transitionContext completeTransition:![transitionContext transitionWasCancelled]];
if(finished)
{
[fromVC endAppearanceTransition];
[toVC endAppearanceTransition];
}
}];
}
我想让 toVC 从一个比例开始并完成以适应屏幕,而 fromVC 从上到下滑动。
滑动已正确插值,但变换只是完成但不插值。
哪里出错了
【问题讨论】:
标签: ios7 controllers