Search code examples
swiftuiimage

swift How to change uiimage background and selected area color


i have a uiimage like this white background and selected area color (red),

i want to save as this image ,

become black background and selected area color become to white,

how can to it ?

enter image description here


Solution

  • You should elaborate a bit. How are you creating the red selection line? My guess is the reds are UIViews and the image is a UIImageView. Put them inside a parent UIView and take snapshot of that parent UIView. Follow this answer for converting UIView to image.