我最近将 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];
}
它按预期工作。
是否有什么我忽略的东西阻止了我的风格被接受?
谢谢,
-范数
最佳答案
在您的头文件中,@property 是不必要的 - 删除它是否可以解决您的问题?
关于iphone - 重写 three20 TTDefaultStyleSheet 样式不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2769811/