How to change the color of the title in TTLauncherItem?

假装没事ソ 提交于 2019-12-03 08:53:16
Hunt IT

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.

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