LoginSignup
11
10

More than 5 years have passed since last update.

[iOS][Swift]ビュー遷移時にタブバーを隠す方法

Posted at

問題

ViewControllerA → ViewControllerB → ViewControllerC
と遷移する時に、
ViewControllerBでタブバーを非表示化したい。
ただし、
ナビゲーションバーの「戻る」ボタンで B から A に戻った時と
B から C に遷移した時はタブバーを再表示する。

解決方法

navigationViewControllerにBをpushする前に、
AのViewControllerのhidesBottomBarWhenPushedをtrueに設定し、
push後にhidesBottomBarWhenPushedをfalseに設定する。

AからBに遷移するコード
self.hidesBottomBarWhenPushed = true
self.navigationController.pushViewController(viewControllerB, animated: true)
self.hidesBottomBarWhenPushed = false
11
10
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
11
10