0

Sorry if I've missed something really obvious here but I'm still quite new to programming :)

So I'm trying to rotate an image view for a mac application, and I found out that in IOS for a UIImageView you can use this code:

myImageView.transform = CGAffineTransformMakeRotation(angle)

However, for OSX NSImageView doesn't seem to have .transform available.

Is there any alternative?

Thanks!

Giulio Crisanti
  • 370
  • 2
  • 12

2 Answers2

1

maybe a bit late, but here you go:

myImageView.wantsLayer = true
myImageView.layer?.transform = // Your transformation right here
IceCoala
  • 45
  • 7
0

Definitely late but hope it helps someone

Swift 5:

let transform = CGAffineTransform(rotationAngle: 1.0) myImageView.wantsLayer = true myImageView.layer?.setAffineTransform(transform)

vigu
  • 21
  • 4