我遇到了 Three20 的 TTSTyledTextLabel 的问题。我已经指定了这样的视图
//iphone properties
htmlSubtitle_ = [[TTStyledTextLabel alloc] init];
htmlSubtitle_.font = [UIFont systemFontOfSize:14];
htmlSubtitle_.contentInset = UIEdgeInsetsMake(2, 2, 2, 2);
htmlSubtitle_.backgroundColor = [UIColor clearColor];
htmlSubtitle_.textColor = [UIColor whiteColor];
htmlSubtitle_.textAlignment = UITextAlignmentCenter;
htmlSubtitle_.userInteractionEnabled = NO;
htmlSubtitle_.text = [TTStyledText textFromXHTML:@"<p><p>I dont know where this\n is going<br/> but it is ok :D</p></p>" lineBreaks:YES URLs:YES];;
htmlSubtitle_.frame = CGRectMake(0, 390, 200, 90);
htmlSubtitle_.backgroundColor = [UIColor greenColor];
[self.view addSubview:htmlSubtitle_];
它看起来像这样:
当我旋转屏幕时,我写了这段代码:
else if (interfaceOrientation == UIInterfaceOrientationLandscapeRight){
htmlSubtitle_.frame = CGRectMake(0, 0, 90, 200);
htmlSubtitle_.transform = CGAffineTransformMakeRotation(M_PI / 2);
htmlSubtitle_.backgroundColor = [UIColor greenColor];
}
它看起来像这样:
查看文本对齐方式,对齐方式已更改为向左而不是保持在中心。其他人有这个问题吗?还是我做错了什么?