GocePetrovski / ScrollableSegmentedControl

Scrollable Segmented Control for when UISegmentedControl is not sufficient
MIT License
245 stars 74 forks source link

Wrong segmented state after highlighted state #34

Open Vorgar opened 5 years ago

Vorgar commented 5 years ago

There is another problem similar to issue #32 and related to the "didset" highlighted logic that affects the attributed title of the segment

To reproduce:

  1. Use text only as segmented style
  2. Have only 2 segments so that the segmented control does not scroll
  3. Set different title text attributes for normal, highlighted and selected states
  4. Tap and hold the selected segment that active is
  5. Slide the finger to left or right until the finger is in the next segment
  6. Lift the finger and the selected segment title stays in the normal attributed state when it should have the selected one

In my tests I have seen that the control can have the following combination states:

I think that the priorities should be highlighted > selected > normal, that means that when isHighlighted is set to false we need to check if it is selected

This problem is present in other segmented styles too