に描いていないが、私はビューベーステーブルビューをカスタマイズし、カスタマイズNSViewの中で、私はINITで書く:CAShapeLayerの問題 - nstableview
NSRect testRect = imageViewRect;
CGMutablePathRef roundPath = CGPathCreateMutable();
CGPathAddArc(roundPath, NULL,
[self arcCenter:testRect].x,
[self arcCenter:testRect].y,
ArcRadius,
2 * M_PI + M_PI_2,
M_PI_2,
YES);
self.backgroundLayer = [CAShapeLayer layer];
self.backgroundLayer.frame = testRect;
self.backgroundLayer.path = roundPath;
self.backgroundLayer.strokeColor = [[NSColor blueColor] CGColor];
self.backgroundLayer.fillColor = nil;
self.backgroundLayer.lineWidth = 5.0f;
self.backgroundLayer.lineJoin = kCALineJoinBevel;
[self.layer addSublayer:self.backgroundLayer];
[self.backgroundLayer setFillColor:[NSColor yellowColor].CGColor];
が、層が示されていない、私は本当に分かりません問題はどこだ。
これをビューに書き込み、ビューをウィンドウにロードすると、レイヤーが正しく表示されます。
本当にありがとうございました。しかし私のデモでは、wantLayerビューをyesに設定していませんでした。デフォルトではNOです。 – melody5417
助けてくれてありがとう、私はちょうど私が受け入れられた答えをマークするためにチェックをクリックする必要があることを知っています。 – melody5417