Hello,
I am attempting to draw this plane with Core Animation:
(without the black background, however).
This is the code in my custom NSView:
I have a view in interface builder with the class set as my custom NSView class. My custom view is set to have a layer. The result is a blank NSWindow. I do not receive any errors or warnings.
Does anyone see where my logical flaw is?
Thanks!
I am attempting to draw this plane with Core Animation:

(without the black background, however).
This is the code in my custom NSView:
Code:
- (id)initWithFrame:(NSRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self A_singlePlane];
}
return self;
}
-(void)A_singlePlane{
CALayer *container = [CALayer layer];
container.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
[self.layer addSublayer:container];
CALayer *purpleLayer = [self addPlaneToLayer:container size:CGSizeMake(100, 100) position:CGPointMake(100, 100) color:[NSColor purpleColor]];
CATransform3D t = CATransform3DIdentity;
t = CATransform3DRotate(t, 45.0f * M_PI / 180.f, 0, 1, 0);
purpleLayer.transform = t;
}
-(CALayer *)addPlaneToLayer:(CALayer* )container size:(CGSize)size position:(CGPoint)point color:(NSColor *)color{
CALayer *plane = [CALayer layer];
plane.backgroundColor = [color CGColor];
plane.opacity = 0.6;
plane.frame = CGRectMake(point.x, point.y, size.width, size.height);
plane.borderColor = [[NSColor colorWithWhite:1.0 alpha:0.5] CGColor];
plane.borderWidth = 3.0;
plane.cornerRadius = 10.0;
[container addSublayer:plane];
return plane;
}
I have a view in interface builder with the class set as my custom NSView class. My custom view is set to have a layer. The result is a blank NSWindow. I do not receive any errors or warnings.
Does anyone see where my logical flaw is?
Thanks!