Easiest way to display a rotated NSString?
Is there an easy way to rotate and display an NSString?
I'm currently using the following to draw on screen but would like to rotate (either +90 or -90 degrees):
I know another option would be to use UILabels and CATransform3D but I can't seem to clear teh screen when calling:
therefore it just gets messy with text displaying over text. I was using the following:
Thanks
I'm currently using the following to draw on screen but would like to rotate (either +90 or -90 degrees):
UIFont *smallFont = [UIFont systemFontOfSize:8];
CGPoint textPoint = CGPointMake(10, 10);
[[NSString stringWithString:@"MY STRING"] drawAtPoint:textPoint withFont:smallFont];
I know another option would be to use UILabels and CATransform3D but I can't seem to clear teh screen when calling:
[self setNeedsDisplay];
therefore it just gets messy with text displaying over text. I was using the following:
UIFont *smallFont = [UIFont systemFontOfSize:8];
UILabel *myLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, 120, 50)];
myLabel.font = smallFont;
myLabel.text = [NSString stringWithString:@"MY STRING"];
myLabel.textColor = [UIColor blackColor];
myLabel.backgroundColor = [UIColor clearColor];
myLabel.textAlignment = UITextAlignmentCenter;
CATransform3D landscapeTransform = CATransform3DIdentity;
landscapeTransform = CATransform3DRotate(landscapeTransform, DegreesToRadians(-90), 0, 0, 1);
myLabel.layer.transform = landscapeTransform;
[self addSubview:myLabel];
[myLabel release];
Thanks
iMac, Mac OS X (10.5.4), N/A