我正在使用如下动画处理 ios 中的选取框文本:
第一种方式:
-(void)startScrolling {
CGRect rect ;
rect = self.titleView.frame;
rect.origin.x = -self.titleView.frame.size.width;
self.titleView.frame = rect;
[UIView beginAnimations:@"" context:nil];
[UIView setAnimationCurve:UIViewAnimationCurveLinear];
[UIView setAnimationDuration:13];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(startScrolling)];
// Update end position
CGRect rect ;
rect = self.titleView.frame;
rect.origin.x = [[UIScreen mainScreen] bounds].size.width;
self.titleView.frame = rect;
[UIView commitAnimations];
}
第二种方式:
[UIView animateWithDuration:13
delay:0
options:UIViewAnimationOptionCurveLinear
animations:^{
CGRect rect ;
rect = self.titleView.frame;
rect.origin.x = -self.titleView.frame.size.width;
self.titleView.frame = rect;
}
completion:^(BOOL finished) {
CGRect rect ;
rect = self.titleView.frame;
rect.origin.x = [[UIScreen mainScreen] bounds].size.width;
self.titleView.frame = rect;
[self startScrolling];
}
];
第一种方法是正常工作。第二种方式的问题是在动画过程中添加了加速度。不明白
为什么在使用块时添加加速。在互联网上搜索,但我仍然卡住了。对这个问题有什么想法吗?