Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I reset after a UIScrollView zoom?
    text
    copied!<p>I have a Graph being drawn inside a <code>UIScrollView</code>. It's one large <code>UIView</code> using a custom subclass of <code>CATiledLayer</code> as its layer.</p> <p>When I zoom in and out of the <code>UIScrollView</code>, I want the graph to resize dynamically like it does when I return the graph from <code>viewForZoomingInScrollView</code>. However, the Graph redraws itself at the new zoom level, and I want to reset the transform scale to 1x1 so that the next time the user zooms, the transform starts from the current view. If I reset the transform to Identity in <code>scrollViewDidEndZooming</code>, it works in the simulator, but throws an <code>EXC_BAD_ACCSES</code> on the device.</p> <p>This doesn't even solve the issue entirely on the simulator either, because the next time the user zooms, the transform resets itself to whatever zoom level it was at, and so it looks like, if I was zoomed to 2x, for example, it's suddenly at 4x. When I finish the zoom, it ends up at the correct scale, but the actual act of zooming looks bad.</p> <p>So first: how do I allow the graph to redraw itself at the standard scale of 1x1 after zooming, and how do I have a smooth zoom throughout?</p> <p><b>Edit:</b> New findings The error seems to be "<code>[CALayer retainCount]: message sent to deallocated instance</code>"</p> <p>I'm never deallocating any layers myself. Before, I wasn't even deleting any views or anything. This error was being thrown on zoom and also on rotate. If I delete the object before rotation and re-add it afterward, it doesn't throw the exception. This is not an option for zooming.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload