WTF? According to multiple articles one/both of these snippets should rotate an NSVIEW around ITS OWN CENTER (ie… it spins)… However what I get e is it rotating around its upper left corner… any one see what is wrong here???
let rotate = CABasicAnimation(keyPath: "transform.rotation") rotate.fillMode = CAMediaTimingFillMode.forwards rotate.fromValue = 0.0 rotate.toValue = CGFloat(M_PI * 2.0) rotate.duration = 1 rotate.repeatCount = Float.infinity self.layer?.position = CGPoint(x: self.frame.midX, y: self.frame.midY) self.layer?.anchorPoint = CGPoint(x: 0.5, y: 0.5) self.layer?.add(rotate, forKey: nil)
self.frameCenterRotation=45 // simply moves the NSView right (no rotation)
self.rotate(byDegrees: 45) // does rotate, but makes it BIGGER, and loses its internal icon