4

I have an UIImageView with UIViewContentModeCenter, so Images that it holds are not getting scaled or deformed. But this way if the image is larger, it can be seen outside the ImageView's frame. I don't want to crop the image (user can scale it, so the loss of data is not an option), but I need to make the part of it outside of ImageView invisible or something

Concuror
  • 408
  • 3
  • 9
  • you can set clipsToBounds property of the UIImageView to YES, this will make sure that your image will remain inside the frame, If you don't want to do this, then need to look for other option? – rishi May 08 '12 at 04:57
  • I've settled to go with `UIImageView` inside a `UIScrollView` . Thanks for the solution though, it does part of the work I aimed for – Concuror May 08 '12 at 05:09
  • something is left in this question? – rishi May 08 '12 at 05:14
  • so posted the solution as answer for the question. – rishi May 08 '12 at 05:18

2 Answers2

8

You need to set clipsToBounds property of the UIImageView to YES.

rishi
  • 11,779
  • 4
  • 40
  • 59
1

My solution was to put UIImageView inside UIScrollView and then manage size and position things inside scrollView.

Concuror
  • 408
  • 3
  • 9