UIImageView centering issue
To understand my problem let's follow this steps.
- Open - XCode -> New Project -> View based application.
- Open View Controller.xib file.
- Drag an image-view into viewController's view.
- Place that image view on center of viewController's view.
- Apply size of 125x125 to image-view.
- Take any image with dimension of 320 width & 460 height.
- Drag tha开发者_C百科t image into your application resources directory.
- Now, Again back to .xib File & select image-view
- Set image (which is in your resources) to image-view
- 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
精彩评论