views:

171

answers:

2

Hi, so I have a UIImageView in a UIView but when I run it in the iPhone Simulator, the image goes beyond the boundaries of the UIView. What's wrong...?

+3  A: 

Have a look at the clipsToBounds property of UIView. If you set this to YES on your view the UIImageView shouldn't extend outside of that view any more.

Thomas Müller
Under "Image View Attributes" (apple-1), click "Clip Subviews". This did it for me. The reason for going over the boundaries was because the original image was larger than the UIView.
Devoted
A: 

You may also benefit from using the Content Mode property in which you can specify how the content is drawn to fit the view. You can set it to fill, fit-to-scale, etc.

Jasarien