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: 308
        
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 that 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.
Thanks in advance for sharing your knowledge.
Sagar.
© Stack Overflow or respective owner