-1

I try to change white background color in segment if UISegmentedControl gets focus. Please look the folowing screenshot: enter image description here

And I need to change this white background color into clear. Something like this: enter image description here

So I've created subclass of UISegmentedControl and ovveride didUpdateFocus(in:with:) Look please the following screenshot: enter image description here

But after that focus doesn't change anymore and I can't jump to next segment of UISegmentedControl.

I saw similar question here, but I wasn't succeed of it.

It's tvOS and deployment target is 11.1.

Why is that? What is the better approach to change background color when focused? Please help me.

Taras
  • 1,485
  • 1
  • 16
  • 31
  • if I use `super.didUpdateFocus(in: context, with: coordinator)`, then focus engine works, but segment in segmented control is highlight with white color like in first screenshot. – Taras May 05 '20 at 06:39

3 Answers3

1

Maybe I misunderstood your question, but have you tried to change segmentControl.selectedSegmentTintColor property?

Artem Boordak
  • 211
  • 3
  • 15
1

I fixed this problem by replacing UISegmentControl to UICollectionView.

Taras
  • 1,485
  • 1
  • 16
  • 31
0

Try this way (at initialization phase):

 segment.selectedSegmentTintColor = .clear

here segment: UISegmentedControl