Search code examples
iphonedrawingdrawrect

Problem with drawRect and a huge view


I have a view that overlays a CATiledlayer. The view is somewhere in the vicinity of 10,000x8,000

When the view is added, the device gives off memory warnings and the screen goes black. I have narrowed it down to the drawRect method and my assumption is that it's because the view is so large. It works fine in the iPhone Simulator but not on the device itself. When I completely remove everything inside the drawRect method, it still fails, but when I remove the entire drawRect method, it works fine(but obviously without my lines).

In the drawRect method, I am just trying to draw a line between a few points on the map.


Solution

  • Use another CATiledLayer to back your overlay view.