sasojadrovski / SJFluidSegmentedControl

A segmented control with custom appearance and interactive animations. Written in Swift 3.0.
MIT License
973 stars 76 forks source link

Segmented control tend to be different when landscape mode. #11

Open andrewlim7 opened 6 years ago

andrewlim7 commented 6 years ago

Hi, the fluid in selectedIndex when in portrait mode and landscape mode are not the same.

guidove commented 6 years ago

I have the same problem. Was able to workaround it by observing rotation changes (UIDeviceOrientationDidChange) and doing this when change detected:

segControl.reloadData() let idx = segControl.currentSegment segControl.setCurrentSegmentIndex(1, animated: false) segControl.setCurrentSegmentIndex(idx, animated: true)

It's a dirty workaround, but it does the trick for now.