Ios7 iOS 7精灵套件帧速率

Ios7 iOS 7精灵套件帧速率,ios7,sprite-kit,Ios7,Sprite Kit,我已经用两种不同的形式为SKScene编写了-update方法,其中一种具有比另一种更好的恒定帧速率 有人能解释一下这两种实现之间的差异,以及它们创建两种不同帧速率的原因吗 Method 1 (frame rate drops to about 20-30 fps when moving sprite) - (void)update:(NSTimeInterval)currentTime { [self updateBackground]; playe

我已经用两种不同的形式为SKScene编写了-update方法,其中一种具有比另一种更好的恒定帧速率

有人能解释一下这两种实现之间的差异,以及它们创建两种不同帧速率的原因吗

Method 1 (frame rate drops to about 20-30 fps when moving sprite)

- (void)update:(NSTimeInterval)currentTime

    {
        [self updateBackground];
        player.position = CGPointMake(slider.sliderValue * self.view.frame.size.width/200 + self.view.frame.size.width/2, player.position.y);
    }


Method 2 (frame rate remains constant 60 fps when moving sprite)

- (void)update:(NSTimeInterval)currentTime
    {
        [self updateBackground];
        delta = currentTime - previousTime;
        previousTime = currentTime;
        //NSLog(@"%f",delta);
        player.position = CGPointMake(delta * adjustmentFactor * slider.sliderValue * self.view.frame.size.width/200 + self.view.frame.size.width/2, player.position.y);
    }

[self-updateBackground]
可能运行缓慢。试着把它拿出来看看这是否会让它更好。谢谢你的评论,我已经测试了它,有和没有[self updateBackground]的结果都是一样的。我认为在这段代码之外还有其他事情发生。代码中的其他地方是否使用了增量?如果没有计算增量,可能会发生一些不希望发生的事情。您是否在设备上进行测试,最好使用发布版本来确认行为?是的,我正在设备上进行测试。