-1

I have figured out how to change the navigation controller to predetermined colors, but I can't figure out how to set it to RGBA. I found a bunch of answers for ios 7 that don't work anymore even after i converted the obj-c to swift.

This is the code that changes the nav controller, but id like custom colors

navigationController!.navigationBar.barTintColor = UIColor.greenColor()
rmaddy
  • 314,917
  • 42
  • 532
  • 579
RubberDucky4444
  • 2,330
  • 5
  • 38
  • 70
  • Update your question with relevant code showing what you are trying to do. – rmaddy Oct 19 '15 at 05:05
  • @rmaddy this is what works so far, but i dont want to use xcode's colors i want to use custom colors override func viewDidLoad() { super.viewDidLoad() navigationController!.navigationBar.barTintColor = UIColor.greenColor() – RubberDucky4444 Oct 19 '15 at 05:08
  • 2
    As I said, update your question, don't put your code in a comment. – rmaddy Oct 19 '15 at 05:09
  • Have you looked at the docs for `UIColor`? There is a clear method for providing RGBA values. – rmaddy Oct 19 '15 at 05:12
  • no ive been googling and searching stack overflow, but I will look for those docs – RubberDucky4444 Oct 19 '15 at 05:15
  • 3
    Always start with the reference docs. It's important to get to know the available APIs. Plus it gives you something to search for once you find something that seems to be what you need but you aren't sure how to use it. – rmaddy Oct 19 '15 at 05:16

1 Answers1

2

Use this One :-

 UINavigationBar.appearance().barTintColor = UIColor(red: 22.0/255.0, green: 106.0/255.0, blue: 176.0/255.0, alpha: 1.0)
Mudith Chathuranga Silva
  • 7,253
  • 2
  • 50
  • 58