Dave Leverton
Dave Leverton

Reputation: 614

How do I rotate an NSTextField on OS X?

Does OS X have an equivalent of [UIView setTransform:] on iOS? I have an NSTextField that I want to rotate 10 degrees. In iOS I’d just use [UILabel setTransform:]. Is there anything equivalent for Cocoa Framework?

Upvotes: 4

Views: 1550

Answers (2)

wattson12
wattson12

Reputation: 11174

frameRotation or frameCenterRotation should do that

Upvotes: 11

David Rönnqvist
David Rönnqvist

Reputation: 56635

You could use the underlying layer and rotate that

myView.wantsLayer = YES;
myView.layer.transform = CATransform3DMakeRotation(angle, 0, 0, 1);

p.s. Remember to import QuartzCore

Upvotes: 4

Related Questions