0
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?

More than 5 years have passed since last update.

画面遷移まとめ vol.2(どこがコードでどこがStoryboardか)[NavigationController等]

Posted at

随時追記していくかもです、気まぐれで。

vol.2ではVCの状態保存にも触れていきます。

用途によるVCの参照の違い

状態保存しなくてもいい時

とりあえず参照できればいいやという人にはこれ

let storyboard = UIStoryboard(bundle: nil)

用途によるNCの生成(設定)の違い

コード: 遷移したタイミングで遷移先以降の遷移がnavigation(push)になってほしい時
storyboard: 遷移がnavigation(push)しかしないと決まっている時(Embed In)

あとで追記

NC自身とNCをEmbed inしたrootVCの違い

navigatonbarの参照
NavigationController: self.title = "hoge"
ViewController(NCをEmbed InしたrootのVC): self.navigationController?.navigationBar.title = "hoge"

->VCはNavigationControllerに埋め込まれてはいるがNCではないのでこういう参照になる
->NCとNCのrootVCはごっちゃになるのでこの辺注意が必要

あとで追記

0
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
0
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?