UISegmentControl with image showing up as black

With iOS 13, I am having where the an UIImage is not being properlty displayed on the screen - I am getting a black blob. I ried setting the tintColor with no luck. I am not using Storyboards and only trying to use images - not text & images.


Any suggestions for a workaround / solution?


Thank you,

Paul

Replies

You do it in code. So please show the code.

And tell how the image is defined ? In xcassets ? As original image or template …


In storyboard, the view settings for the segment are:

Alpha: 1

Background: default (clear)

drawing : non opaque


Note: I just tested in storyboard, works immediately. Why don't you use storyboard ?

Why do you think you have correctly loaded the image you think you have loaded - check that code. The 'black blob' may be a nil UIimage. For example, perhaps the name of the file that is storing the image is incorrect in:

myImage=[UIImage imageNamed:@"MyImage"];  // image is MyImage.png 


or it is not included in Build Phases in the target.

In Swift

let myImage = UIImage(named: "My Image")


Need to check uppercase and lowarcase as well.