开发者

How to change the color of the title in TTLauncherItem?

I am having a lot of trouble trying to change the color in the TTLauncherItem, because the def开发者_运维知识库ault gray color does no work with my background.

Any ideas?


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜