开发者

TTStyledTextLabel font size not honored

I tried with the TTCatelog sample comes with Three20 framework, on the StyledTextTestController, somehow the font size is not honored at all, they all showed as the same font and size. Is there any special setting to turn that on?

The following is what there in the sample code, which supposedly will show the "bah" as large text, and "humhug" as small text. But in the emulator, they all the same.

@implementation TextTestStyleSheet

- (TTStyle*)largeText {
  return [TTTextStyle styleWithFont:[UIFont systemFontOfSize:32] next:nil];
}

- (TTStyle*)smallText {
  return [TTTextStyle styleWithFont:[UIFont systemFontOfSize:12] next:nil];
}

@end

@implementation StyledTextTestController

- (id)ini开发者_开发问答t {
  if (self = [super init]) {
    [TTStyleSheet setGlobalStyleSheet:[[[TextTestStyleSheet alloc] init] autorelease]];
  }
  return self;
}


- (void)loadView {
  [super loadView];

  NSString* kText = @"<span class=\"largeText\">bah</span> <span class=\"smallText\">humbug</span>";

  TTStyledTextLabel* label1 = [[[TTStyledTextLabel alloc] initWithFrame:self.view.bounds] autorelease];
  label1.text = [TTStyledText textFromXHTML:kText lineBreaks:YES URLs:YES];
  label1.contentInset = UIEdgeInsetsMake(10, 10, 10, 10);
  [label1 sizeToFit];
  [self.view addSubview:label1];
}

@end

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜