为什么不使用UIViewAnimationOptionCurveEaseOut和UIViewAnimationOptionCurveEaseIn动画选项作为标签? 只需设置标签的frame.origin.x = [在超级视角范围的右侧外] ,并在想要再次使用EasyOut动画进行滑动时将其设置回原始位置。 这就是我讲的东西......
CFRect frame = self.listLabel.frame;
//Point to hide your label by sliding it outside the right side of it's parent's view.
// mask or clipToBounds of parent's view must be YES
frame.origin.x = [self.listLabel.superview.frame.size.width];
[UIView animateWithDuration:0.1
delay:0.0
options:UIViewAnimationOptionCurveEaseIn
animations:^{
[self.listLabel setFrame:frame];
}
completion:nil];
,当你想在向后滑动,使用相反的动画和标签的原始位置,当然你需要保存它的原始位置的地方,所以你可以滑动 - 在它回来。
[UIView animateWithDuration:0.1
delay:0.0
options:UIViewAnimationOptionCurveEaseOut
animations:^{
[self.listLabel setFrame:label_original_frame];
}
completion:nil];