0

I have an NSWindow with a NSView (stored in a nib):

enter image description here

I'm trying to add a BezierPath to a layer for that view (self.view2):

CAShapeLayer* circleLayer = [CAShapeLayer layer];
[self.view2 setLayer:circleLayer];

circleLayer.fillColor = [NSColor redColor].CGColor;
circleLayer.path = [NSBezierPath bezierPathWithOvalInRect:self.view2.bounds].quartzPath;
circleLayer.strokeColor = [NSColor blueColor].CGColor;
circleLayer.strokeStart = 0.0f;
circleLayer.strokeEnd = 0.5f;
circleLayer.lineWidth = 5.0f;
circleLayer.transform = CATransform3DMakeRotation(135.0 / 180.0 * M_PI, 0.0, 0.0, 1.0);

This is what I get back:

enter image description here

Why isn't the resulting view aligned properly (i.e., top right like it's on my nib)?

James
  • 1,689
  • 3
  • 17
  • 21

1 Answers1

0

I just needed to put that code inside awakeFromNib() instead of applicationDidFinishLaunching(). Now it works.

James
  • 1,689
  • 3
  • 17
  • 21