Home:ALL Converter>Increase distance between inner view and segmented control layer

Increase distance between inner view and segmented control layer

Ask Time:2020-05-12T12:05:59         Author:Altynbek Tanbayev

Json Formatter

I have segmented control in my app. So far I make it like in image below:

image

Is there any way to change distance between layer of inner view (white view for selected segment) and layer of segmented control to make it like in the following image?

image2

Here is my code for segmented control:

private let segmentedControl: UISegmentedControl = {
    let control = UISegmentedControl(items: ["My likes", "Inbox"])
    control.backgroundColor = AppColor.segmented.uiColor.withAlphaComponent(0.1)
    control.layer.cornerRadius = 10
    control.selectedSegmentIndex = 0
    return control
}()

P/S. I know that I am able to do it without segmented control but using buttons.

Author:Altynbek Tanbayev,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/61743644/increase-distance-between-inner-view-and-segmented-control-layer
yy