tags:

views:

1265

answers:

1

Hi

I am using a TTPhotoViewController subclass from the Three20 library for showing images from a web location. The images load up fine but the navigation bar and toolbar show up with the default tint. I am using a nav bar with a custom tint (set in the MainWindow.xib)

I tried these things to get it to show black translucent bars but none of these seem to work.

  1. setting the navigation bar style to black translucent in MainWindow.xib
  2. setting the navigation bar style to black opaque in MainWindow.xib
  3. Explicitly setting the navigationbar style to black translucent in the subclass's viewWillAppear:

Can someone please tell me why this would happen and how I can solve this? Thanks.

+11  A: 

EDIT: I'm an idiot. You're trying to set the style, not the color. The below is all valid information, but what you almost certainly want is the navigationBarStyle property defined by TTViewController. Sorry.


Three20 has a "style sheet" mechanism built into it, the intended purpose of which is to save you from having to set tint colors, fonts, etc. on all of the many UI objects in your app, over and over. However, if you don't know it's there, you end up in exactly this situation. What you need to do is:

Create a subclass of TTDefaultStyleSheet in your application, and override at least this method:

- (UIColor*)navigationBarTintColor {
  return RGBCOLOR(119, 140, 168);
}

Someplace in your app (probably applicationDidFinishLaunching:), call:

[TTStyleSheet setGlobalStyleSheet:
  [[[YourStyleSheetClass alloc] init] autorelease]];

(You might want to browse around in TTDefaultStyleSheet.h, because there are a whole pile of other styles defined there that are used by the framework, and that you might also want to override.)

Sixten Otto