I created a button in SwiftUI with these line of codes:
Button(action: { print("button pressed") }) { Image("marker") }
but marker
image automatically changes to blue color.
I want to use original image in button.
this is original marker.png
:
but SwiftUI changes it to this:
I remember we have tintColor or something like this in UIButton
, but I can't find it in SwiftUI.
Another way to set programmatically:-
var body: some View { Button(action: { print("button pressed") }) { Image("marker") .renderingMode(Image.TemplateRenderingMode?.init(Image.TemplateRenderingMode.original)) } }
Go to the image and change the Render As "Original Image"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With