Three20 library - subclass of TTPhotoViewController has an opaque navigation bar

微笑、不失礼 提交于 2019-12-03 07:48:56

问题


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.


回答1:


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.)



来源:https://stackoverflow.com/questions/1653767/three20-library-subclass-of-ttphotoviewcontroller-has-an-opaque-navigation-bar

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!