6
7

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.

iOS - ナビバー、ツールバーに背景画像を設定する

Posted at

完成図

スクリーンショット 2015-11-22 23.24.28.png

コード

override func viewDidLoad() {
    super.viewDidLoad()
    self.view.backgroundColor = UIColor.grayColor()
    self.navigationController?.toolbarHidden = false
    self.navigationController?.navigationBar.setBackgroundImage(UIImage(named: "navibarImage"), forBarPosition: .TopAttached, barMetrics: .Default)
    self.navigationController?.toolbar.setBackgroundImage(UIImage(named: "toolbarImage"), forToolbarPosition: .Bottom, barMetrics: .Default)
}

ちなみにnavibarImageの高さは64にしています。

参考記事

6
7
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
6
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?