开发者

How to redraw the content view of UIScrollView

I have a subview in a UIScrollView and it seems the view is distorted when every tim开发者_Python百科e 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.


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.


I believe what you want is

[view setNeedsDisplay];

or

[view setNeedsDisplayInRect:(CGRect)myRect];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜