LoginSignup
13
11

More than 5 years have passed since last update.

【備忘録】NavigationControllerの下線を削除する

Posted at

結論

下記処理を記載すると、アプリ内で使用するNavigationBarは下線が削除される。


    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        UINavigationBar.appearance().setBackgroundImage(UIImage(), forBarMetrics: UIBarMetrics.Default)
        UINavigationBar.appearance().shadowImage = UIImage()
        return true
    }

背景

NavigationBarの下線を消したくて、情報探しましたが、少し手こずったので備忘録を
・・・。

余談

UINavigationBar.appearance()で取得されるインスタンスは何なんだろう???'appearance()'に設定を行うとアプリ内全体に反映されるようでした。

その為、結論で記載した内容は、AppDelegate#didFinishLaunchingWithOptionsに処理(アプリ起動時に実行されているところ)を書いておきました。

13
11
1

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
13
11