A UISegmentedControl
has a new appearance in iOS 13 and existing code to alter the colors of the segmented control no longer work as they did.
Prior to
If you want to set the background to clear you have to do this:
if #available(iOS 13.0, *) {
let image = UIImage()
let size = CGSize(width: 1, height: segmentedControl.intrinsicContentSize.height)
UIGraphicsBeginImageContextWithOptions(size, false, 0.0)
image.draw(in: CGRect(origin: .zero, size: size))
let scaledImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
segmentedControl.setBackgroundImage(scaledImage, for: .normal, barMetrics: .default)
segmentedControl.setDividerImage(scaledImage, forLeftSegmentState: .normal, rightSegmentState: .normal, barMetrics: .default)
}