Stretchable UIImage and CGAffineTransform
I've got a UI开发者_如何学编程ScrollView
whose zoom behavior I want to confine to the horizontal axis. I've accomplished that through using a custom UIView
as the viewForZoomingInScrollView:
and overriding setTransform:
. So far so good – the view only zooms horizontally.
One catch: The container view includes some stretchable UIImage
instances in UIImageView
s. Obviously, with the transform in effect, the images distort.
What's the best bet for either redrawing the view so that the images aren't distorted, or, zooming the view in such a way as to not require transforms in the first place?
Thanks for any help you can offer.
You sure way of achieving this is to make your UIImageView into a custom UIView, and have its drawRect:
code do the right thing: draw both stretched and unstretched elements.
精彩评论