Reputation: 776
In ViewDidAppear, I have changed the alpha value of the navigation bar to 0.15, but the right navigation bar item became almost invisible as well.
self.navigationController?.navigationBar.alpha = 0.15
Is it possible to change the transparency/alpha value of the right navigation bar item so that it is fully visible (alpha = 1) while having the navigation bar itself be 0.15?
Upvotes: 2
Views: 8827
Reputation: 36640
The property changed in Swift 4.0 and is now:
navigationController?.navigationBar.barTintColor = UIColor.black.withAlphaComponent(0.15)
Just substitute black for whatever color you want.
Upvotes: 0
Reputation: 287
You're setting the alpha of the entire bar to 0.15. You should be setting only the barTintColor
attribute of it to a color with an alpha of 0.15 like so:
self.navigationController?.navigationBar.barTintColor = UIColor.yourColorGoesHere().colorWithAlphaComponent(0.15)
Upvotes: 6