【发布时间】:2010-05-05 00:20:38
【问题描述】:
我最近将 three20 集成到我的应用程序中,并试图覆盖 TTWebController 中的默认工具栏颜色。
在 TTWebController.m:118 我看到这是设置工具栏的 tintColor:
_toolbar.tintColor = TTSTYLEVAR(toolbarTintColor);
所以我创建了自己的样式表,它继承了 TTDefaultStyleSheet 并覆盖了toolbarTintColor
FooStyleSheet.h:
#import <Three20Style/Three20Style.h>
#import <Three20Style/TTStyleSheet.h>
#import <Three20Style/TTDefaultStyleSheet.h>
@interface FooStyleSheet : TTDefaultStyleSheet
@property (nonatomic, readonly) UIColor* toolbarTintColor;
@end
FooStyleSheet.m:
#import "FooStyleSheet.h"
@implementation RaptrStyleSheet
- (UIColor*)toolbarTintColor {
return RGBCOLOR(0, 0, 0); // should override TTDefaultStyleSheet
}
@end
在我的应用程序中:didFinishLaunchingWithOptions:我设置了我的默认样式表
[TTStyleSheet setGlobalStyleSheet:[[[FooStyleSheet alloc] init] autorelease]];
但是当我查看 TTWebController 时,它并没有继承我的 tintColor。如果我直接编辑 TTDefaultStyleSheet.m:
- (UIColor*)toolbarTintColor {
return [UIColor blackColor];
}
它按预期工作。
是否有什么我忽略的东西阻止了我的风格被采纳?
谢谢,
-规范
【问题讨论】:
-
嗨 funkadelic,您找到问题的答案了吗?
标签: iphone objective-c three20 subclassing