user1413558
user1413558

Reputation: 3929

How to make the UIImagePickerController image not resize when displayed on imageview

I'm very new with uiimageviews and I had a question about UIImagePickerController. In my app the user selects an image, which is then displayed on a uiimageview. Then it resizes the picture so every part of it fits on the imageview, causing a distorted image. Is there a way to have the imageview not resize the image to fit its boundaries? Thanks!

EDIT: While the first answer does center the image, I would also like the user to be able to pinch the image to zoom in and out

EDIT #2 The answer I choose set me in the right direction for properly displaying the image. For zooming, i found this to solve it iphone uiscrollview and uiimageview - setting initial zoom

Upvotes: 0

Views: 1132

Answers (2)

Jeanne
Jeanne

Reputation: 85

If you are not using Auto Layout (and from what I have experienced so far, you probably shouldn't- it's temperamental and doesn't work with iOS 5), you can adjust the springs (inside double arrows) in the size inspector.

You could also try deselecting "Autoresize Subviews" in the parent view's Attributes Inspector. This would only work if you wanted it to apply to all sibling subviews, though.

Upvotes: -1

Mick MacCallum
Mick MacCallum

Reputation: 130222

Your image view's content mode is probably set to either scale to fill or scale to fit. Try setting it to top left, center, etc. depending on what you want.

[myImageView setContentMode:UIViewContentModeCenter];

Upvotes: 1

Related Questions