简体   繁体   中英

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. 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.

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. [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来创建无尽的效果。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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