Reputation: 3444
I am writing an app for the iPad/iPhone and am looking for a suggestion on how I would go about displaying text at an arbitrary angle on the iPhone and iPad using xCode?
Thanks for the advice.
Best, Tony
Upvotes: 1
Views: 3328
Reputation: 57149
You can set the transform
property of any UIView
—such as, in this case, a UILabel
—to adjust its rotation, among many other things. For example:
myLabel.transform = CGAffineTransformMakeRotation(30 * M_PI / 180.0);
would rotate your label by 30 degrees.
Upvotes: 11
Reputation: 2567
Not exactly sure if this is what you're looking for but just add the text to a UILabel:
UILabel *label = [[UILabel alloc] initWithFrame:someFrame];
label.text = @"Some Text";
and then add a transform to the label to rotate it to whichever arbitrary angle you desire:
label.transform = CGAffineTransformMakeRotation(someAngleInRadians);
[self.view addSubview:label];
[label release];
Just set the value for someAngleInRadians to the angle you wish to rotate the text to (in radians of course).
Cheers
Upvotes: 2