Reputation: 3506
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.
Upvotes: 1
Views: 353
Reputation: 733
10000*8000 is an immense view - it's no surprise you're getting memory issues. It will work in the simulator because you have far more memory on your computer, but to give you an idea of the worst case, a full RGBA buffer space of that size would take up 10000*8000*4 bytes, or around 305MB!
What's your code like inside the method? If you want anything realistic to come of a view that big, you're probably going to have to do things very differently. In this case, your view should be only the size of the screen (320*480 on the phone), and you make a rectangle representing your world (10000*8000) and another rectangle representing your view. Then draw your lines based on their relative position in the world space to the view space.
Upvotes: 3