UIImageView with stretchableImageWithLeftCapWidth doesn't stretch image

后端 未结 2 778
星月不相逢
星月不相逢 2021-01-05 17:48

I\'m trying to stretch an Image in a UIImageView - but I fail miserably :)

Following setup:

NIB-File with a view and a UIImageView attached to this view.

相关标签:
2条回答
  • 2021-01-05 17:50

    Got it... (interesting that this happens often just seconds after asking the question)

    In IB, I had to set the mode in the UIImageView to «Scale to fill» and set the Autoresize-property

    That's what solved the problem...

    Hope that helps somebody ;)

    0 讨论(0)
  • 2021-01-05 18:10

    Sometimes it depends on the file, However I did two things to fix it and I don't know which was the solution:

    • Open and resave the file (I don't think this made the difference)
    • Create the file.png and file@2x.png file. (Anyway this should always be done with stretchable images)

    After I added the @2x file the image stretched ok.

    0 讨论(0)
提交回复
热议问题