如何在TTLauncherItem中更改标题的颜色? [英] How to change the color of the title in TTLauncherItem?

查看:90
本文介绍了如何在TTLauncherItem中更改标题的颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试更改TTLauncherItem中的颜色时遇到了很多麻烦,因为默认的灰色对我的背景不起作用.

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.

有什么想法吗?

推荐答案

这是我用来将TTLauncherItem的文本颜色从默认的灰色更改为黑色(在白色背景上看起来更好)的原因:

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)创建一个从TTDefaultStyleSheet继承的样式表:

(1) Create a Stylesheet that inherits from TTDefaultStyleSheet:

Stylesheet.h:

Stylesheet.h:

@interface StyleSheet : TTDefaultStyleSheet {}   
@end

Stylesheet.m:

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)在AppDelegate.m中,初始化样式表:

(2) In AppDelegate.m, initialize the Stylesheet:

[TTStyleSheet setGlobalStyleSheet:[[[StyleSheet alloc] init] autorelease]];

就这样...在样式表中,更改UIFontRGBCOLOR(0, 0, 0)以满足您的要求.

That's it ... in the Stylesheet, change the UIFont and RGBCOLOR(0, 0, 0) to suit your requirements.

这篇关于如何在TTLauncherItem中更改标题的颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆