2

I am trying to set the background and trasparecy for UINavigation bar in code, in the ViewWillAppear func. however it doesn't seem to be working.

self.navigationController!.navigationBar.translucent = false
self.navigationController!.navigationBar.backgroundColor = UIColor.blackColor()

the view controller is load via the storyboard id

  let storyboard = UIStoryboard(name: "Main", bundle: nil)
  let vc = storyboard.instantiateViewControllerWithIdentifier(storyboardId)
  vc.title = storyboardId
  let navigationController = UINavigationController(rootViewController: vc)
  self.presentViewController(navigationController, animated: false, completion: nil)

i have tried setting it there too, doesn't seem to be working.

additionally i tried with UINavigationBar.appearance() to set the properties, this too doesn't work.

Jinah Adam
  • 1,125
  • 2
  • 14
  • 27
  • Possible duplicate of [How to make UINavigationBar Transparent in IOS 8?](http://stackoverflow.com/questions/27228317/how-to-make-uinavigationbar-transparent-in-ios-8) – Alessandro Ornano May 18 '16 at 08:24

1 Answers1

1

You can try with this:

self.navigationController?.barTintColor = UIColor.blackColor()

Manuel
  • 1,675
  • 12
  • 18