Iphone – How to redraw the content view of UIScrollView

iphone

I have a subview in a UIScrollView and it seems the view is distorted when every time I zoom out or in the content view. As described here by Brad Larson that I must set some transform values and redraw the content view. Now my problem is how can I redraw my content view. The content view of the UIScrollView is a UIView with UIButtons subviews. Should I remove that UIView from my UIScrollView then add again?

Thanks.

Best Answer

What you'll want to do is manually resize and relayout each of your buttons to account for the new scale factor that the UIScrollView has presented you in the -scrollViewDidEndZooming:withView:atScale: delegate method.

This can be done by looping through your UIButtons and adjusting their frames with their new calculated positions and sizes. The UIButtons will redraw themselves sharply at the new scale factor.