Re: UIScrollView challenge: allow zoom out to see full content
Re: UIScrollView challenge: allow zoom out to see full content
- Subject: Re: UIScrollView challenge: allow zoom out to see full content
- From: Rick Mann <email@hidden>
- Date: Thu, 20 Jun 2013 17:00:25 -0700
Bah, the idea of making the image match the aspect ratio doesn't work because it doesn't support changing ratios (e.g. rotation).
On Jun 20, 2013, at 16:11 , Rick Mann <email@hidden> wrote:
> I have a basic UIScrollView working with pinch zoom and pan under autolayout. There are still issues, including very jumpy zoom, and I still need to find the right way to add some subviews that need to "stick" to the image as it zooms.
>
> Another challenge is this: allowing the user to zoom out far enough to see the whole image while a) keeping the image centered, and b) without exposing any views that might be behind the scroll view.
>
> The image will rarely have the same aspect ratio as the scroll view.
>
> The second requirement is not an absolute requirement. Currently I have placeholder art behind the scroll view that appears when there's no image to show, because I set the alpha of the image view to 0. I can also hide and show the placeholder art when I do this, or make the scroll view opaque and hide it instead of the image (that is, in fact, what I will likely do).
>
> One way to get the image to zoom out nicely (stay centered) is to ensure it's rendered with the same aspect ratio as the UIScrollView. This may be the most expedient way. The image is generated from data and rendered onto a black background, so it's reasonable to do the math to create another image of the correct aspect ratio that totally fits the generated image.
>
> But it seems like autolayout and UIScrollView should be smart enough to do this anyway. Currently, if I allow zooming out to a scale less than 1.0, the image scoots over to the upper-left. But really, it seems that autolayout and UIScrollView should know how to handle this for me.
>
> Suggestions? Thanks!
>
>
>
> --
> Rick
>
>
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
--
Rick
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden