doucumet說CAShapLayer是反鋸齒的,爲什麼會得到這個結果。 我也在drawRect方法中用CGContext繪製一個圓圈,它非常完美。爲什麼cashapelayer的圓形路徑不那麼圓?
UIBezierPath *path = [UIBezierPath bezierPath];
[path appendPath:[UIBezierPath bezierPathWithOvalInRect:CGRectMake(150, 300, 136, 136)]];
self.circleLayer = [CAShapeLayer layer];
self.circleLayer.path = path.CGPath;
self.circleLayer.frame = self.bounds;
self.circleLayer.fillColor = [[UIColor whiteColor] colorWithAlphaComponent:0.6].CGColor;
[self.layer addSublayer:self.circleLayer];
你問我們如何關閉抗鋸齒?或者,你的Core Graphics轉換也在進行反鋸齒,你只是想知道爲什麼這兩者有所不同? – Rob
順便說一句,我發現,如果你使用'UIBezierPath'方法'addArcWithCenter'具有非整數半徑(例如150.2 vs 150),'CAShapeLayer'的反鋸齒工件不會分散注意力。 – Rob