TimOliver / TOSegmentedControl

A segmented control in the style of iOS 13 compatible with previous versions of iOS.
MIT License
196 stars 24 forks source link

Manually setting `selectedSegmentIndex` doesn't update the UI #29

Open DantePuglisi opened 3 years ago

DantePuglisi commented 3 years ago

It's quite unintuitive (and undocumented) that by doing: segmentedControl.selectedSegmentIndex = 0 nothing happens in the UI (actually something happens but it's quite glitchy) and the way it works is by doing segmentedControl.setSelectedSegmentIndex(0, animated: true)

Is this on purpose?

TimOliver commented 3 years ago

Nope, it's not on purpose.

If we're talking about things being unintuitive, what do you mean by "something happens but it's quite glitchy"? 😜

DantePuglisi commented 3 years ago

I thought maybe it was on purpose that's why I made that comment 🙈. So if you do segmentedControl.selectedSegmentIndex = 0 the selectedSegmentedIndex gets changed but it's not shown on the UI (UI doesn't change accordingly)