UIImageView Centering Problem.

Posted by sagar on Stack Overflow See other posts from Stack Overflow or by sagar
Published on 2010-03-31T10:36:06Z Indexed on 2010/03/31 10:53 UTC
Read the original article Hit count: 261

To understand my problem let's follow this steps.

  1. Open - XCode -> New Project -> View based application.
  2. Open View Controller.xib file.
  3. Drag an image-view into viewController's view.
  4. Place that image view on center of viewController's view.
  5. Apply size of 125x125 to image-view.
  6. Take any image with dimension of 320 width & 460 height.
  7. Drag that image into your application resources directory.
  8. Now, Again back to .xib File & select image-view
  9. Set image (which is in your resources) to image-view
  10. Set Image-view Mode to - Center

Ok. Let me explain the situation now.

  • after performing all above steps - image-view has an image which is larger than image-view's size.
  • However, Image-view places that image on center & in View controller image-view is looking proper ( not scaled ).
  • But When you run your application, image-view will be displayed in size of 320x460. ( but it is not actually scaled. )

Now, I can't find the reason, why interface builder is displaying something else & simulator/iphone is displaying something else ?

My Query.

  • I want the image's center portion within image-view no matter what image size is.

Thanks in advance for sharing your knowledge.

Sagar.

© Stack Overflow or respective owner

Related posts about uiimageview

Related posts about uiimage