LoginSignup
23

More than 5 years have passed since last update.

Swift3.0 NavigationBarをhidden(隠す)方法

Last updated at Posted at 2017-04-06

はじめに

この記事はswift初心者が開発してるときにいい記事ないなーと思ったため
メモみたいな感じで書いています。

実装

ViewController.swift
navigationController?.setNavigationBarHidden(true, animated: false)

これをこのままviewWillAppearに書けばNavigationBarが隠れます。
遷移先のviewWillAppear関数にコピペすればおっけーです

豆知識

NavigationBarがhiddenになっていると画面を横に引っ張っても前の画面に
戻らなくなるのを知って便利やなーって思いましたw
navigationController?.interactivePopGestureRecognizer?.isEnabled = false

これを書けば横に引っ張っても前の画面に戻らなくなるように実装できるみたいです。

最後に

twitterフォロー待ってます!
https://twitter.com/kano0512s
アドバイスなどコメント欄に書いてもらえると勉強になるので嬉しいです。

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
23