Resizing an image with stretchableImageWithLeftCapWidth

后端 未结 7 1767
闹比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:23

    It seems like you're writing a lot of unnecessary code, but perhaps that's just because it's out of context and there's more to it that I'm missing.

    To get the image:

    [[UIImage imageName: @"bottom_part.png"] stretchableImageWithLeftCapWidth: 27 topCapHeight: 9];
    

    What part of your code are you displaying this image? i.e. in what method call are you drawing the images above?

    Why not just use a UIImageView and put the image in there? Then you don't need to do any of the image context drawing etc.

提交回复
热议问题