1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

iOS18でタブを押した際に画面がチラつく現象への対応

Last updated at Posted at 2024-11-03

どうした

iOS18でUITabBarControllerで実装したタブをタップしたら、遷移時に画面が一瞬チラつくようになった。
NavigationBarの色も反転して見栄えが悪いので何とかしたい

発生している環境

  • Swift
  • Xcode 16.0
  • iOS18端末

対応

UITabBarControllerDelegateを実装して、遷移時のアニメーションを無効化する

func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool {
    // アニメーションだめー
    UIView.setAnimationsEnabled(false)
    return true
}
    
func tabBarController(_ tabBarController: UITabBarController, didSelect viewController: UIViewController) {
    // アニメーションどうぞ
    UIView.setAnimationsEnabled(true)
}

参考

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?