How to get transparent background on UIControlSegment?

Hi, I would like to know how to get a transparent background in the new iOS 13's UIControlSegment. Currently it only makes the `backgroundColor` set programatically darker. I want to set it to transparent or set a gradient image on it.
The current colors look terrible on my app and I am willing to move it to a third party solution.
Why this component sets the white color as grayish? This is really confusing and I can't find any easy way to disable this.

Replies

Here you can see the color difference, note that the rect at the middle is a divider with color set UIColor.clear.

The bottom and top colors are what it should be. Note that the middle is darker than the colors outside.


https://imgur.com/a/CP4qwUX


Another bug: If you press and drag the component while the color is selected, it doesn't change the status unless you release your finger. I have tried to set the colors for all UIControl.State, no change is visible.


https://imgur.com/a/KhjEdUR

No way, unfortunately.


Even if you set a clear color, there will be a grey layer.

The same if you set the same color as the background.


So, if you really need it, you'll have to design your own, I fear.


Have a look here for detailed explanation and some hints to solve some issues. But not totally yours.


h ttps://medium.com/flawless-app-stories/ios-13-uisegmentedcontrol-3-important-changes-d3a94fdd6763


You should file an ehancement request, may be it will be listened to if we are a lot to ask. But chances are slim, it is a UI design feature, I doubt Apple wants to compromise on this.

I am locked with this component, I cannot even change the color of the animated divider. It's barely visible by modifying the background color of its parent.
This is also easy to bypass if you don't set a super light color by making the background lighter, so the color will match. Not nice.

If you are locked with this component, signal the problem to their author.


There is nothing more you can do.

I am talking about UISegmentedControl from Apple 😁

Yes, signal to Apple !


I tried to play with the different layers of the control. No time to investigate much, but may be you can find a way. (use the Debug View Hierarchy whilst running in simulator to find.