アニメーションなしでモーダルをdismissしてから次の画面をpresentしてもチラつく
guard let presentingViewController = presentingViewController else { return }
presentingViewController.dismiss(
animated: false,
completion: { [presentingViewController] in
presentingViewController.present(
次の画面のViewController,
animated: false,
completion: {}
)
}
)
上記のように
dismissのcompletionで次の画面にモーダルで遷移するためにpresent処理を書いた場合、
dismiss, present ともにアニメーションを false にしているにもかかわらず、土台となっているpresentingViewControllerの画面が一瞬現れます(チラつきます)
completionという文字通り、dismissが完了してから、土台となるpresentingViewControllerに次の画面を載せているので、完了してから次の画面を載せるまでの少しの間、チラついたように見えるのではないかと推測しています。
チラつきを抑える方法はないでしょうか?
なんとなく、下記にコメントの部分に書いたようなメソッドをがあるとよいのではないかと考えています。
guard let presentingViewController = presentingViewController else { return }
// アニメーションを抑えるメソッド!!
presentingViewController.dismiss(
animated: false,
completion: { [presentingViewController] in
presentingViewController.present(
次の画面のViewController,
animated: false,
completion: {}
)
}
)
// アニメーションを抑えるメソッドのとりやめ!!