我有两张照片。第一个是透明孔,应该是静态的,而第二个是像图像的滑板车,需要连续水平滚动才能产生视频效果。
有人可以建议我做些什么来实现同样的目标。
答案 0 :(得分:0)
您可以像这样设置图像视图的X位置:
CGPoint point0 = imView.layer.position;
CGPoint point1 = { NSIntegerMax, point0.y };
CABasicAnimation *anim = [CABasicAnimation animationWithKeyPath:@"position.x"];
anim.fromValue = @(point0.x);
anim.toValue = @(point1.x);
anim.duration = 1.5f;
anim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn];
// First we update the model layer's property.
imView.layer.position = point1;
// Now we attach the animation.
[imView.layer addAnimation:anim forKey:@"position.x"];
对于无限滚动,请正确设置滚动视图“contentSize
:
scrollView.contentSize = CGSizeMake(NSIntegerMax, kScreenHeight); // Deduce kScreenHeight based on device height
答案 1 :(得分:0)
请检查代码Infinity Scroll