How to remove border from segmented control

后端 未结 9 2211
刺人心
刺人心 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:45

    Hope it will help someone

    Swift - 4

    Make the Background color and Tint color of your Segment control to same color. Then "set titleTextAttributes" of your Segment control

        segmentedControl.tintColor = UIColor.red
        segmentedControl.backgroundColor = UIColor.red
        let attributes = [NSAttributedStringKey.foregroundColor: UIColor.white]
        segmentedControl.setTitleTextAttributes(attributes, for: .normal)
        segmentedControl.setTitleTextAttributes(attributes, for: .selected)
    

提交回复
热议问题