Resizing an image with stretchableImageWithLeftCapWidth

后端 未结 7 1771
闹比i
闹比i 2020-12-29 00:39

I\'m trying to resize an image using stretchableImageWithLeftCapWidth: it works on the simulator, but on the device, vertical green bars appears.

I\'ve tried to use

7条回答
  •  不思量自难忘°
    2020-12-29 01:28

    In my case I had an UIImageView which I stretched horizontally. I found a strange vertical white line in the stretched image.

    The solutions above didn't work for me. However, the following did:

    Cast the width value to an int value:

    myNewViewFrame.size.width = (int)newWidth;
    myView.frame = myNewViewFrame;
    

    Hope it works for you guys as well...

提交回复
热议问题