【发布时间】:2012-04-27 14:06:53
【问题描述】:
我必须一张一张地滚动图像。以下是我正在使用的代码
_imageView 是 UIImageView,imagesArray 是带有对象数组的 NSArray。
_imageView.animationImages=imagesArray;
_imageView.animationDuration=10;
[_imageView startAnimating];
CABasicAnimation *scrollText;
scrollText=[CABasicAnimation animationWithKeyPath:@"position.x"];
scrollText.duration = 10.0;
scrollText.speed= 3;
scrollText.repeatCount = 0;
scrollText.autoreverses = NO;
scrollText.fromValue = [NSNumber numberWithFloat:500];
scrollText.toValue = [NSNumber numberWithFloat:-200.0];
[[_imageView layer] addAnimation:scrollText forKey:@"scrollTextKey"];
我可以看到图像正在滚动,并且正在一张一张地变化。 但这些图像都在不断变化。当图像离开框架/屏幕时,我想一张一张地更改图像。任何人都可以提出一些想法吗?
【问题讨论】:
标签: ios xcode cabasicanimation