LoginSignup
1
2

More than 3 years have passed since last update.

【Swift】モーダル遷移かつNavigationBarも表示させたいかつフルスクリーンで表示させたい

Posted at

どういうことか

  • 下からヌッと出てくるモーダルで遷移させたい
  • そいつにNavigationBarもつけたい
  • さらにフルスクリーンで表示させたい

コードで書きます。

実装

たとえばボタンを押したときのアクションなんかに書く。

ViewController.swift
let storyboard: UIStoryboard = self.storyboard!
let vc = storyboard.instantiateViewController(withIdentifier: "nextView")

let nav = UINavigationController(rootViewController: vc)
nav.modalPresentationStyle = .fullScreen

self.present(nav,animated: true)

閉じるボタンがないのでNavigationBarとかに作るといいと思う。
おわり(´・ω・`)

1
2
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
2