gpt4 book ai didi

ios - 如何暂停/恢复 NSTIMER?

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:43:40 25 4
gpt4 key购买 nike

<分区>

我是这样使用 NSTimer 的

  GameTimer=[NSTimer scheduledTimerWithTimeInterval:60.0/60.0 target:self selector:@selector(Move) userInfo:nil repeats:YES];

在 Move 方法中,我更新了 View 的位置。

-(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];

}

如何暂停和恢复游戏计时器?

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com