@Travis, thanks. Effectively, it works with a systemImage.
So I should set to template.
But can I do this in IB or do I have to do it in code ?
I tried this, to no avail, still a black image:
let flag = UIImage(named: "Flags")?.withRenderingMode(.alwaysTemplate)
testSegmentedControl.setImage(flag, forSegmentAt: 0)
testSegmentedControl.setImage(flag, forSegmentAt: 1)
print(flag, flag?.renderingMode)
renderingMode is defined as print shows:
Optional(<UIImage:0x60000300c870 anonymous {24, 16}
renderingMode=alwaysTemplate>) Optional(__C.UIImageRenderingMode)
Got it: it has to be .alwaysOriginal. Then it works
I do not see it possible in IB:
Got it; I can set the mode of the image in xcassets.