31 Mar 2009 @ 1:22 PM 

Boy today was a frustrating day.  Over the past month or so, when I have some free time at work I’ve been learning Objective C to create iPhone applications.

Today, I struggled and struggled to do the most simplistic thing ever and I wanted to share it with everyone so if you get stuck with the same problem, hopefully you will solve it a lot quicker than I did.

What I was trying to do was to change the background color of the “blue” navigation header.

Let me provide a bit of background information on what I was doing, so if you are having the same problem, you will solve it nice and quickly.

I have a UITabBarController defined in my app delegate.  Inside of there I create a UINavigationController and instantiate that with a UITableViewController that I have created.

Everything was working perfectly, then we wanted to change the blue to a red to match our logo.  Sounds easy enough right?  It sure is, when you know what you’re doing.  I struggled thinking that it was part of the UITableViewHeader, found a couple of examples of that, but I couldn’t get them working or looking like I wanted it to.

After some wasted time, I then realized that it is the UINavigationController that draws the blue background.  After some more trial and error and banging my head against the wall, I finally figured it out.  You simply do the following:

 navigationController.navigationItem.tintColor = [UIColor redColor];

That’s it, now it’s no longer blue!

  • Share/Bookmark

Other useful articles

Posted By: Jamie
Last Edit: 31 Mar 2009 @ 01:22 PM

EmailPermalink
Tags


 

Responses to this post » (One Total)

 
  1. Tao says:

    correction, it is navigationController.navigationBar.tintColor

    not navigationController.navigationItem.tintColor

Post a Comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>


 Last 50 Posts
 Back
Change Theme...
  • Users » 14
  • Posts/Pages » 75
  • Comments » 231
Change Theme...
  • VoidVoid « Default
  • LifeLife
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LightLight