Search code examples
iosuikituistepper

iOS Trouble setting increment and decrement images for UIStepper


I'm able to set a background image fine with:

self.setBackgroundImage(image, for: .normal)

But if I do these:

self.setDecrementImage(image, for: .normal)
self.setIncrementImage(image, for: .normal)

The increment side changes the '+' into a blue square like so:

enter image description here

The decrement side is also actually a blue rectangle, except since it's the exact size of the minus symbol it still looks just like a minus symbol. I can correct this by giving it a different size.

Anyone dealt with this? Is there something special about the images for the increment/decrement sides as oppose to the background?


Solution

  • Is there something special about the images

    Sure, they are template images. If that isn't what you want, you need to call UIImage withRenderingMode to make a nontemplate image (.alwaysOriginal).