ios - 带有自定义动画的 PresentViewController
<p><p>我需要用 UIViewAnimationOptionCurveEaseIn 动画呈现 ViewController ,其中源 Controller 从 1 alpha 消失到 0,目标 Controller 从 0 alpha 出现到 1</p>
<p>我想使用</p>
<pre><code>presentViewController: animated: completion:
</code></pre>
<p>我试过了:</p>
<p>在源 Controller 中</p>
<pre><code>UIStoryboard *st = .infoDictionary objectForKey:@"UIMainStoryboardFile"] bundle:];
PopViewController *pop =;
UINavigationController *nav = [ initWithRootViewController:pop];
nav.navigationBarHidden = YES;
[UIView animateWithDuration:0.5 delay:0 options:UIViewAnimationOptionCurveEaseIn animations:^{
self.view.alpha = 0.f;
} completion:^(BOOL finished) {
;
}];
</code></pre>
<p>在目标 Controller 中</p>
<pre><code>- (void)viewDidLoad{
;
self.view.alpha = 0.f;
[UIView animateWithDuration:0.5 delay:0 options:UIViewAnimationOptionCurveEaseIn animations:^{
self.view.alpha = 1.f;
} completion:^(BOOL finished) {
}];
</code></pre>
<p>但 Controller 消失和出现的时间不同</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>例如帕维尔</p>
<pre><code>-(void)goToViewControllerAction
{
;
;
CATransition *transition = ;
];
transition.duration = 1.5;
;
;
;// Here your push or performSegue transition
;
}
</code></pre>
<p>不要记得使用 QuartzCore)</p>
<p>您可以根据需要自定义过渡,其中有很多不同的设置.... </p></p>
<p style="font-size: 20px;">关于ios - 带有自定义动画的 PresentViewController,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/32141804/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/32141804/
</a>
</p>
页:
[1]