UIImage and UIImageView strange behaviour

Discussion in 'iOS Programming' started by namanhams, Jun 24, 2011.

  1. namanhams, Jun 24, 2011
    Last edited: Jun 24, 2011

    namanhams macrumors regular

    Joined:
    Jun 3, 2009
    #1
    I have an image with detail :
    - Dimension : 930 x 1433 pixels
    - Resolution : 71 pixels / inch

    The image has left/top/right/bottom border with black color

    I display the image inside an UIImageView. The mode is "Scale to fill"
    - If i set the width of the UIImageView to 84, i totally can not see the left border
    - If i set the width to 85, i can see the left border but it's very blur
    - If i set the width bigger and bigger, the left border appears clearer
    - If i set the width to 120, it becomes normal

    The same happens for top/bottom border
    - Set height to 110 : can not see top/bottom border
    - Set height to 120 : can see but still blur
    - Set height to 140 : they become normal

    I test it in the iPad simulator 4.3. When i view it in Interface Builder, it appears normal.

    Anyone have any hint ?
    Thanks.
     
  2. jnoxx macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #2
    In your IB. Have u thought about your View, that is in your NIB File. That it has a Navigation/Tool/Tabbar that you are not "telling" it about. Or even the gray status bar on top? (which costs u 20px too).
    I Have had huge amounts of trouble with IB Before, but it was all because I'm doing code on top of that. Which makes it confused ;)
     
  3. namanhams thread starter macrumors regular

    Joined:
    Jun 3, 2009
    #3
    I'm not sure i understand what you say. My issue is with the border of the image. There's nothing to deal with the Navigation/Tool/Tab bar.
     
  4. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #4
    How wide is the border? This does not sound strange to me: the image is being scaled so the border is going to get smaller and smaller as you make the image smaller and smaller. If you want a constant border with a scaling image within it this is not the way to do it.
     
  5. namanhams thread starter macrumors regular

    Joined:
    Jun 3, 2009
    #5
    I also guess it's the reason, but how come it appears normally in Interface Builder ?

    Thanks.
     
  6. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #6
    Possibly because Interface Builder is not using the same scaling code or even the same screen to display the result.
     

Share This Page