I want to overlay a large CATiledLayer
with some vector drawing. To get started I'd like to use CAShapeLayer
, which is to be replaced by some custom CALayer
subclass or delegate.
The good part is that it works. However, I get this warning on every redraw:
-[<CAShapeLayer: 0x1700daa0> display]: Ignoring bogus layer size (150000.000000, 150000.000000), contentsScale 1.000000, backing store size (150000.000000, 150000.000000)
How do I get rid of this warning properly?
I figure I don't need a backing store, since the whole point of this layer is that it only (and continuously) draws the visible part of the layer.
One (accidentally discovered) way to prevent this error is to set layer.contentsScale
to a small value or even zero, so the backing store will not have a "bogus sized" backing store. (this property is normally used to allow @2x/@3x devices to have a high-res backing store)
But this feels like a hack that will break my app some day. So how can I disable the backing store for a CALayer?
CATiledLayer (a subclass CALayer) doesn't give such a warning, despite having the same size. I've looked into subclassing CALayer or CAShapeLayer, trying to replicate CAShapeLayer, but this is quite confusing. CAShapeLayer doesn't seem to play by the same rules as me; my drawInContext:
renders vectors pixelated while the layer draws its own vectors crisp, even within the same CALayer. The almost-undocumented layer.contents
property only refers to a backing store for my pixelated lines.
Is it even possible to re-create CAShapeLayer with the public API?