How to change the color of the title in TTLauncher

2019-03-21 16:05发布

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?

2条回答
甜甜的少女心
2楼-- · 2019-03-21 16:23

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.

查看更多
劫难
3楼-- · 2019-03-21 16:26

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.

查看更多
登录 后发表回答