开发者

UIImageView centering issue

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 tha开发者_C百科t 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.


In the IB click on your image and in drawing section Check "Clip subviews" Option

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜