On my UITableViewCell
I set imageView.image
. This is a simple black icon on a transparent background.
I want to invert it, when the cell is selected/highlighted, which can be done by setting the cell's imageView.highlightedImage
.
I've tried this but that returns nil, and also tried this which turns transparent parts white so you see a white square when cell is selected.
What's the proper way to invert a UIImage
for this purpose (which works for both normal and retina screens)? So, I only want to invert the colours; alpha should be preserved.