我创建了一个UIPresentationController,它为tintAdjustmentViewPresentationController 添加了一个简单的方法containerView:
- (void)presentationTransitionWillBegin {
UIView* containerView = [self containerView];
[containerView insertSubview:self.tintAdjustmentView atIndex:0];
self.tintAdjustmentView.frame = containerView.bounds;
self.tintAdjustmentView.alpha = 0.f;
id<UIViewControllerTransitionCoordinator> coordinator = [[self presentedViewController] transitionCoordinator];
if (coordinator) {
[coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext>context) {
[self.tintAdjustmentView setAlpha:1.0];
} completion:nil];
} else {
[self.tintAdjustmentView setAlpha:1.0];
}
}
Run Code Online (Sandbox Code Playgroud)
当我使用基本<UIViewControllerAnimatedTransitioning>对象时,它可以根据需要工作 - 调整视图在动画时更新alpha.
现在,我也开始使用自定义<UIViewControllerInteractiveTransitioning>对象来支持交互式转换.请注意,这不是一个UIPercentDrivenInteractionTransition对象.
不幸的是,tintAdjustmentView当我使用交互式转换时,它没有动画.如何为视图设置动画以及交互式过渡?
| 归档时间: |
|
| 查看次数: |
371 次 |
| 最近记录: |