我有一个蓝色的渐变图像。它是 100 像素(高度)x 1 像素(宽度)。现在我试图将它用作突出显示状态的背景图像。但不知何故,它在运行时变成了橙色。这里可能有什么问题?按钮的高度是 40px,所以我在设置它之前做了一个调整大小
UIImage *image = [UIImage imageNamed:@"pressed.png"];
UIImage *stretchedImage = [[UIImage imageWithImage:image scaledToSize:frame.size] stretchableImageWithLeftCapWidth:0 topCapHeight:0];
[button setBackgroundImage:stretchedImage forState:UIControlStateHighlighted];