How can I render a custom view in a UIScrollView at varying zoom levels without distorting the view?

Posted by eczarny on Stack Overflow See other posts from Stack Overflow or by eczarny
Published on 2009-01-08T21:02:04Z Indexed on 2010/04/09 22:23 UTC
Read the original article Hit count: 339

Filed under:

The scenario:

I have a custom view (a subclass of UIView) that draws a game board. To enable the ability to zoom into, and pan around, the board I added my view as a subview of UIScrollView. This kind of works, but the game board is being rendered incorrectly. Everything is kind of fuzzy, and nothing looks right.

The question:

How can I force my view to be redrawn correctly ay varying scales? I'm providing my view with the current scale and sending it a setNeedsDisplay message after the scroll view is done zooming in/out, but the game board is still being rendered incorrectly. My view should be redrawing the game board depending on the zoom level, but this isn't happening. Does the scroll view perform a generic transformation on subviews? Is there a way to disable this behavior?

© Stack Overflow or respective owner

Related posts about cocoa-touch