Domanda

I am having a problem with Three20's TTSTyledTextLabel. i have specified the view like this

//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_];

it looks like this : enter image description here

And when i rotate the screen i have written this code :

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

and it looks like this :

enter image description here

see the text alignment, the alignment has been changed to left instead of remaining in center. is somebody else having this problem? or am i doing something wrong?

È stato utile?

Soluzione

I have used UIWebView to show the HTML Styled Text instead of using this TTStyledLabel crap ... Thanx everybody.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top