【问题标题】:overridden three20 TTDefaultStyleSheet style not working覆盖的three20 TTDefaultStyleSheet 样式不起作用
【发布时间】: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


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2020-10-31
    • 2020-07-10
    • 2016-12-22
    • 1970-01-01
    • 1970-01-01
    • 2019-09-01
    • 1970-01-01
    • 2011-07-02
    • 2020-03-04
    相关资源
    最近更新 更多