Tag: while循环

while循环使用NSTimer

我想创build一个运行的NSTimer可以说10分钟。 然后我想在延迟10分钟的时间之后写一个while循环,之后执行这行。 例如。 NSTimer * countDown = [NSTimer scheduledTimerWithTimeInterval:10.0 target:self selector:@selector userInfo:nil repeats:NO]; while (countDown == stil running (hasnt reached 10 minute mark) ){ // kill 10 minutes of time }//when 10 minutes is up execute next line of code

旋转imageView,同时移动它

所以我有一个名为图像的UIView ,我试图让它旋转,而我上下移动视图,这是我迄今为止所做的,但它使图片旋转,而不是下降: { return centerY – height / 2 <= 10 || centerY + height/ 2 >= self.view.bounds.size.height – 10; } -(void)moveUpDownTimerCallback { [UIView commitAnimations]; verticalSpeed += acceleration; degrees+=degreechange; CGSize sz = image.bounds.size; image.transform = CGAffineTransformMakeRotation(degrees * M_PI/180),image.layer.anchorPoint = CGPointMake(rotPointx/sz.width,rotPointy/sz.height);rotPointy = image.center.y; rotPointx = image.center.x; CGPoint newCenter = CGPointMake(image.center.x, image.center.y + verticalSpeed); if ([self hasCollided: […]