0
我忙着UIViewControllers之間的自定義動畫化的轉變,我喜歡UIView的跳躍,然後填寫類似下面屏幕截圖空間:如何創建自定義計時功能?
現在還沒有一個「選項」我可以創造這樣的效果。現在我可以創建一個關鍵幀動畫,頂部有一個關鍵點,中間有一個關鍵點,但這不會讓人覺得很自然,它會感覺到機器人。
如何解決這個問題?
SOURCE(SO FAR)
- (void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext
{
UIViewController *fromVC = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
UIViewController *toVC = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
UIView *container = [transitionContext containerView];
if ([fromVC isEqual:self])
{
[_activeCardView.superview bringSubviewToFront:_activeCardView];
[UIView animateKeyframesWithDuration:[self transitionDuration:transitionContext]
delay:0.0
options:UIViewKeyframeAnimationOptionCalculationModeCubic
animations:^{
[_activeCardView setFrame:CGRectMake(0.0, 0.0, toVC.view.bounds.size.width, toVC.view.bounds.size.height)];
}
completion:^(BOOL finished){
[container addSubview:toVC.view];
[transitionContext completeTransition:YES];
}];
}
else
{
[container addSubview:toVC.view];
[UIView animateWithDuration:[self transitionDuration:transitionContext]
animations:^{
[_activeCardView setFrame:_basicCardFrame];
}
completion:^(BOOL finished){
[transitionContext completeTransition:YES];
}];
}
}
這可能工作,使動畫緩解和緩解可能會給彎曲加速度的錯覺。我會去嘗試一下。 – Mark