views:

618

answers:

1

I have imageViews as content for in the UIScrollView. If a user is viewing a potrait picture (320x480) and moves the iPhone in landscape orientation - the image stretches to occupy full screen. I want to restrict the image to stretch. I want a functionality similar to the photos app where image is scaled down and shows black strips in left and right.

Anyone with any suggestion how I can achieve this - would be a great help!

A: 

When you rotate, instead of letting your UIIMageView expand, resize its frame to be what you want it to be...that should take care of it.

Daniel
Yes - I figured that out just after posting the question. But I guess I will have to scale the image too. Otherwise it shows only a part of the image. Any idea how can I do that?
AJ
Got it to work! Though the fix is not related to the view resize. All I had to do was add this line <pre><code> view.contentMode = UIViewContentModeScaleAspectToFit; </code></pre>THis thing would take care of it all.
AJ