Closed reggian closed 7 years ago
You can fix this by starting the animation from current state like so:
- (void)_moveThumbToSelectedSegment:(NSInteger)index animated:(BOOL)animated { CGRect newSelectionRect = [self _rectForSegmentAtIndex:index]; if (animated) { CGPoint fromCenter = (self.thumb.layer.presentationLayer ? self.thumb.layer.presentationLayer.position : self.thumb.center); CGPoint newCenter = [self _centerForSegmentAtIndex:index]; CABasicAnimation *thumbAnimation = [self _thumbUpdateAnimationWithFromCenter:fromCenter toCenter:newCenter]; [self.thumb.layer addAnimation:thumbAnimation forKey:@"basic"]; self.thumb.layer.position = newCenter; CABasicAnimation *maskAnimation = [self _thumbUpdateAnimationWithFromCenter:fromCenter toCenter:newCenter]; [self.thumbShowLayer.layer addAnimation:maskAnimation forKey:@"position"]; self.thumbShowLayer.layer.position = newCenter; } else { [self _moveThumbToNewFrame:newSelectionRect]; } }
Closing and released this fix with 1.0.7. Thanks for the issue and fix 👍
You can fix this by starting the animation from current state like so: