这样的_currentChosedLabel会从最初的位置动画移动到下面设置的位置;
[UIView animateWithDuration:0.3950 animations:^{
_currentChosedLabel.frame = CGRectMake(sender.frame.origin.x, _currentChosedLabel.frame.origin.y, sender.frame.size.width, _currentChosedLabel.frame.size.height);
} completion:^(BOOL finished){
}];
// [UIView beginAnimations:nil context:NULL];
// [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
// [UIView setAnimationBeginsFromCurrentState:YES];
// [UIView setAnimationDuration:0.3950];
// _currentChosedLabel.frame = CGRectMake(sender.frame.origin.x, _currentChosedLabel.frame.origin.y, sender.frame.size.width, _currentChosedLabel.frame.size.height);
// [UIView commitAnimations];
这篇博客介绍了如何使用UIView动画来实现一个UILabel在水平方向上的平滑移动效果,通过设置动画持续时间和目标位置,使_currentChosedLabel从起始位置平移到指定坐标。

237

被折叠的 条评论
为什么被折叠?



