0

i have a segment control

let mySegmentControl = UISegmentedControl()

i add two titles for it

mySegmentControl.setTitle(title: "one", forSegmentAt: 0)
mySegmentControl.setTitle(title: "two", forSegmentAt: 1)

i add a label badge to "one"

let myBagdeLabel = UILable(badgeText: "0")
mySegmentControl.addSubView(myBagdeLabel)

the issue is: when "one" is seleted the myBagdeLabel is displayed behind the background color. i did search but did not see any code to fix this issue. see my pictures.enter image description here

coders
  • 2,287
  • 1
  • 12
  • 20

1 Answers1

0

try mySegmentControl.bringSubview(toFront: myBadgeLabel)

tassinari
  • 2,313
  • 2
  • 24
  • 32
  • did try and this did not work mySegmentControl.addSubView(myBagdeLabel) brings myBagdeLabel to the top already – coders Jan 15 '18 at 13:41