我正在使用此代码为视图控制器设置缩放过渡 -
if (self.isPresenting) {
[containerView addSubview:toVC.view];
[toVC.view setAlpha:0];
CGAffineTransform xForm = toVC.view.transform;
toVC.view.transform = CGAffineTransformScale(xForm, 1.0f, 0.8f);
[UIView animateWithDuration:[self transitionDuration:transitionContext]
animations:^{
[toVC.view setAlpha:1];
toVC.view.transform =
CGAffineTransformScale(xForm, 1.0f, 1.0f);
fromVC.view.transform =
CGAffineTransformScale(fromVC.view.transform, 1.0f, 1.0f);
}
completion:^(BOOL finished) {
[transitionContext completeTransition:YES];
}];
}
else {
[containerView addSubview:toVC.view];
[containerView addSubview:fromVC.view];
CGAffineTransform xForm = toVC.view.transform;
toVC.view.transform = CGAffineTransformScale(toVC.view.transform, 1.0f, 1.0f);
[UIView animateWithDuration:[self transitionDuration:transitionContext]
animations:^{
[fromVC.view setAlpha:0];
fromVC.view.transform =
CGAffineTransformScale(xForm, 0.7f, 0.7f);
toVC.view.transform =
CGAffineTransformScale(CGAffineTransformIdentity, 1.0f, 1.0f);
}
completion:^(BOOL finished) {
[transitionContext completeTransition:YES];
}];
}
当它存在时工作完美并且解除视图(在后退按钮上单击)但我需要做的是当用户从上到下拖动视图时它也应该关闭视图控制器。
任何帮助我该如何添加?