Search code examples
iphoneiosuinavigationcontrolleruinavigationbar

How to change the toolbar color of the Navigation Controller in iOS?


I am trying to change the color of my navigation bar. The following rgb is for a dark red color, but my nav bar turns white after the following code.

navigationController.navigationBar.tintColor = [UIColor colorWithRed:117 green:4 blue:32 alpha:1];

Solution

  • This is because the CGFloat values range from 0.0 to 1.0 not from 0 to 255, and values above 1.0 are interpreted as 1.0.

    Here is the documentation:UIColor