4

我最近将 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];
}

它按预期工作。

有什么我忽略的东西阻止了我的风格被接受吗?

谢谢,
-规范

4

1 回答 1

0

在您的头文件中,@property 是不必要的 - 删除它可以解决您的问题吗?

于 2011-05-10T22:58:11.743 回答