iOS - CAShapeLayer anti-aliasing?

2019-07-12 13:15发布

问题:

I have two rhombus shapes next to each other, and I'd like the edges of them to fit together seamlessly.

At the moment, due to anti-aliasing, the background bleeds through even though the edges are as close together as possible. I'd like not to have to overlap the shapes.

Does anyone have any tips? Thanks

回答1:

You should be able to use something like this.

yourLayer.magnificationFilter = kCAFilterNearest;

You'll need to import QC first but you prob already have.

EDIT

magnificationFilter The filter used when increasing the size of the content.

@property(copy) NSString *magnificationFilter Discussion The possible values for magnificationFilter are shown in “Scaling Filters”. The default value is kCAFilterLinear.

Availability Available in iOS 2.0 and later. Declared In CALayer.h