简体   繁体   English

如何使UIImageView在屏幕上永远重复[x轴]

[英]How to make a UIImageView repeat forever across the screen [x-axis]

I am developing a game on xCode, but I ran into a problem. 我正在xCode上开发游戏,但遇到了问题。 I was able to make the UIImageView move <------- left across the iPhone screen, but it I want it to repeat as soon as it begins to move so it could look endless. 我能够使UIImageView在iPhone屏幕上向左移动<-------,但是我希望它在开始移动后立即重复,因此它看起来很长。

http://i.stack.imgur.com/dxbnH.png

Lets say that one piece of the floor in that app is a UIImageView , how can I make that UIImageView repeat across the screen [x-axis] as shown in that app. 可以说该应用程序中的一块地板是UIImageView ,我如何才能使该UIImageView在该应用程序中所示的屏幕[x轴]上重复显示。 [NOT MY APP] [不是我的应用]

-(void)whiteFloor{
    whiteFloor.center = CGPointMake(whiteFloor.center.x-1);   
    if(whiteFloor.center.x < 130){
        [self placeGround];
    }
}

-(void)placeGround {
    // Also would I need to make a int?
    //what would write here
}

我敢肯定,如果您使用SpriteKit,有更好的方法,但是如果您不想使用它,则可以一个接一个地使用2个UIImageView来创建无尽的效果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM