sasojadrovski / SJFluidSegmentedControl

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

Setting current segment index in viewDidLoad #5

Closed Billydubb closed 7 years ago

Billydubb commented 7 years ago

Hi, I have tried setting the current segment index to some other value than 0 in viewDidLoad but the segment just remains at the first position. Same in viewWillAppear.

If I call the following line inside viewDidAppear, the segment switches to the correct position segmentedControl.setCurrentSegmentIndex(startingSegment, animated: false) If, however I make the above call in viewDidLoad or viewWillAppear or the following call anywhere, the segments just don't change

tabBarControl.currentSegment = startingSegment

My question is, how can I make a segment change be effective from viewDidLoad or viewWillAppear, so that there will be no visible transitioning of segment positions?

sasojadrovski commented 7 years ago

@capt-hook's pull request #6 solves this :) I will release a new version soon.