1
0

More than 1 year has passed since last update.

Android,iOSで画面遷移時のバックスタックを制御する方法

Last updated at Posted at 2022-04-07

やること

A, B, Cの3つの画面があります。
AからCに遷移した後、Cでバックボタンを押下したときにBに戻るようにします。

Android (Navigation Architecture Component)

navigateメソッドを2回使用して、A→B→Cと遷移させます。

navController.navigate(R.id.action_aFragment_to_bFragment)
navController.navigate(R.id.action_bFragment_to_cFragment)

iOS(UINavigationController)

UINavigationControllerのsetViewControllersメソッドを使います。

navigationController?.setViewControllers([self, bVC, cVC], animated: true)
1
0
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
0