Question

I created a navigation bar programmatically, and as far as I know, you can only make it "UIColor BlackColor" or "WhiteColor" or whatever. So the options are limited. Is there a way to be able to choose from a color palette or something, or use RGB sliders or some way to have thousands of color options?

Was it helpful?

Solution

Sure. You can make an arbitrary UIColor like so:

UIColor *theColor = [UIColor colorWithRed:0.5f
                                    green:0.75f
                                     blue:0.0f
                                    alpha:1.0f];

OTHER TIPS

You can set the color by using the command:

    navigationController.navigationBar.tintColor = [UIColor colorWithRed: green: blue: ] 

Or the pre made colors in UIColor by typing:

    [UIColor blueColor]; 

"blue" being able to be replaced with many basic colors like black, red, grey, green, etc.

But if you want an image as the background of the NavBar, you need to make a custom class that is a subclass of UINavigationBar.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top