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

Scenario:

I have a custom view (subclass of UIView) that draws the playing field. To enable the ability to scale and pan on the board, I added my view as a UIScrollView subtask. Similar work, but the game board does not handle correctly. Everything seems fuzzy and nothing looks right.

Question:

How can I make my view redraw correctly at different scales? I give my view to the current scale and send it a setNeedsDisplay message after the scroll view is scaled to / from, but the game panel still doesn't display correctly. My opinion should be to redraw the playing field depending on the zoom level, but this does not happen. Does scrolling view general conversion in subviews? Is there any way to disable this behavior?

+3
source share
1 answer

The easiest way to do this is to make the playing field with a really high resolution, and then let the ScrollView handle automatically scale it to your screen size.

, contentSize ScrollView - (, 1024x1024) , (, 1024x1024). ScrollView . setNeedsDisplay - ; , .

0

All Articles