【发布时间】:2011-01-04 03:37:16
【问题描述】:
这样做的正确方法是什么?这是我正在尝试的。但是在 dotLayer 上永远不会调用 display:
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
DotLayer *dotLayer = [[DotLayer alloc]init ];
dotLayer.frame= CGRectMake(10, 10, 100, 100);
dotLayer.nDots = 4;
NSView *contentView = window.contentView;
CALayer *layer = [[CALayer alloc]init];
layer.frame = CGRectMake(0,0,200,200);
contentView.layer = layer;
[layer addSublayer:dotLayer];
[dotLayer setNeedsDisplay];
}
DotLayer 是 CALayer 的子类。
【问题讨论】: