2012-07-04 48 views
0

我遇到了Three20的TTSTyledTextLabel問題。我已指定這樣使用變換旋轉時,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_]; 

它看起來像這樣的觀點: enter image description here

當我轉動我寫了這個代碼的屏幕:

else if (interfaceOrientation == UIInterfaceOrientationLandscapeRight){ 
    htmlSubtitle_.frame = CGRectMake(0, 0, 90, 200); 
    htmlSubtitle_.transform = CGAffineTransformMakeRotation(M_PI/2); 
    htmlSubtitle_.backgroundColor = [UIColor greenColor]; 
} 

,它看起來是這樣的:

enter image description here

查看文本對齊方式,對齊方式已更改爲左側而不是保留在中間位置。是有人有這個問題嗎?或者我做錯了什麼?

回答

0

我已經使用UIWebView來顯示HTML樣式文本,而不是使用此TTStyledLabel廢話...感謝每個人。