iphone - 重写 three20 TTDefaultStyleSheet 样式不起作用

标签 iphone objective-c three20 subclassing

我最近将 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/

相关文章:

ios - 如何通过 ios UIViewControllers 注入(inject)依赖项

iphone - TTNavigator popViewController?

objective-c - TTLauncherItem : change badge immediately (or: how to refresh TTLauncherView)

iphone - XML 到 NSdictionary 到 plist

iphone - 转换后的 Objective-C 类类型不匹配

iphone - 我们怎样才能让 kCAOnOrderOut 工作呢?

xcode - 生成错误: File not found after Time-Machine Restore to new SSD (Xcode)

iPhone 动画问题 SIMulator 与 Real Device

iphone - 如何在我的MKMapView中添加街景功能?

objective-c - Objective-C 中的约束网络