我正在使用这样的 NSTimer
GameTimer=[NSTimer scheduledTimerWithTimeInterval:60.0/60.0 target:self selector:@selector(Move) userInfo:nil repeats:YES];
在 Move 方法中,我更新了视图的位置。
-(void)Move
{
CGRect OldPosition=self.JumbleWordView.frame;
CGRect NewPosition=CGRectMake(OldPosition.origin.x, OldPosition.origin.y+MovementPerSec, OldPosition.size.width, OldPosition.size.height);
[self.JumbleWordView setFrame:NewPosition];
if (NewPosition.origin.y>=Slot_Left*CurrentBlockSize)
{
[self checkResult];
[Mytimer invalidate];
if (!isAnswerCorrect)
{
[self swapViews];
TotalRowPenalty=TotalRowPenalty+1;
Score=Score+RowIncompletePoints;
ScoreLab.text=[NSString stringWithFormat:@"%d",Score];
}
[self LoadNextWord];
}
如何暂停和恢复游戏计时器?