【发布时间】:2014-03-18 09:25:41
【问题描述】:
我有一个名为 clouds 的 UIView。它当前移动到屏幕的右侧,一旦全部离开,它就会重新出现在左侧。
如何让它在离开右侧时重新出现在左侧?所以当它开始从右侧离开时,刚刚消失的位又出现在左侧。
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
movement = [NSTimer scheduledTimerWithTimeInterval:0.05 target:self selector:@selector(moving) userInfo:nil repeats:YES];
cloudsMovement = 2;
}
-(void)platformMovement{
clouds.center = CGPointMake(clouds.center.x + cloudsMovement, clouds.center.y);
}
-(void)moving{
if (clouds.center.x < -11){
clouds.center = CGPointMake(330, clouds.center.y);
}
if (clouds.center.x > 330){
clouds.center = CGPointMake(-11, clouds.center.y);
}
[self platformMovement];
}
任何帮助将不胜感激,谢谢!
【问题讨论】:
标签: iphone animation uiview uiimageview