问题
I am having a lot of trouble trying to change the color in the TTLauncherItem, because the default gray color does no work with my background.
Any ideas?
回答1:
Here's what I used to change the text color of TTLauncherItem
from the default gray color to black (looks better on a white background):
(1) Create a Stylesheet that inherits from TTDefaultStyleSheet
:
Stylesheet.h:
@interface StyleSheet : TTDefaultStyleSheet {}
@end
Stylesheet.m:
// Style for TTLauncherItems
- (TTStyle*)launcherButton:(UIControlState)state {
return
[TTPartStyle styleWithName: @"image"
style: TTSTYLESTATE(launcherButtonImage:, state)
next: [TTTextStyle
styleWithFont:[UIFont boldSystemFontOfSize:11]
color: RGBCOLOR(0, 0, 0)
minimumFontSize: 11
shadowColor: nil
shadowOffset: CGSizeZero
next: nil]];
}
(2) In AppDelegate.m, initialize the Stylesheet:
[TTStyleSheet setGlobalStyleSheet:[[[StyleSheet alloc] init] autorelease]];
That's it ... in the Stylesheet, change the UIFont
and RGBCOLOR(0, 0, 0)
to suit your requirements.
回答2:
You can find the answer here: http://groups.google.com/group/three20/browse_thread/thread/552d453dea748645
Basically you need to set a TTStyleSheet and perform all you customizations there.
来源:https://stackoverflow.com/questions/3770467/how-to-change-the-color-of-the-title-in-ttlauncheritem