문제

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?

도움이 되었습니까?

해결책

Sure. You can make an arbitrary UIColor like so:

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

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top