How to remove border from segmented control

后端 未结 9 2127
刺人心
刺人心 2020-12-03 05:04

How do I remove the outside border of a segmented control? I\'ve set the divider image to what I wanted but now to follow the mock of my app I need to have a segmented cont

9条回答
  •  有刺的猬
    2020-12-03 05:54

    • The accepted answer works for getting rid of the border.
    • The solution mentioned here also works for disabling the segmented Control.

    Yet putting the two solutions together, I wasn't able to get the correct selected segment in a disabled state.

    What I wanted was that upon selecting a segment and making a network call, I wanted to disable the segmented control.

    The outcome was like this:

    What was desired was this:

    The only addition to Sohil's solution is:

    setBackgroundImage(imageWithColor(color: imageWithColor(color: tintColor)), for: [.selected, .disabled], barMetrics: .default)
    

    After the selected && disabled segment will have the right color.

提交回复
热议问题