iOS - CAShapeLayer anti-aliasing?

2019-07-12 12:35发布

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条回答
在下西门庆
2楼-- · 2019-07-12 13:24

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

查看更多
登录 后发表回答