1

I would like to scale my drawings in -drawRect: without stretching the original (lossless). Is there a way to scale everything up to create a zoom effect ? Let's say I draw a circle in -drawRect: with a size of, say 20x20 and then I would go ahead and pinch on my view. Is there a way to tell this hypothetical Circle class to draw everything twice or multiple times the size ?

the_critic
  • 12,720
  • 19
  • 67
  • 115
  • http://stackoverflow.com/questions/4964083/zoom-core-graphics-in-uiscrollview and http://stackoverflow.com/questions/5889517/zoomable-graphics. Basically, you are drawing *pixels*, not *objects*. The suggested answers prefer drawing large and displaying small, so you can zoom in. A slower but better alternative would be to create a stack of draw primitives and scale mathematically (and it'd be slow because you have to check *every* object, although some basic grid caching may help with this). – Jongware Oct 26 '13 at 00:53
  • You might give `contentsScale` a try if you are using a `CALayer` for rendering CoreGraphics drawings. – Christian Di Lorenzo Oct 26 '13 at 02:01
  • @Martin E. you can use `CATiledLayer` for the same, it prevents loss of quality. Good Luck – Dipen Panchasara Oct 26 '13 at 04:14
  • Thanks I will try all three of these and see which works best! – the_critic Oct 26 '13 at 08:34

0 Answers0