0

我想在 xcode 中制作无限滚动背景,但是当我使用此代码时:

    if (self.myAnimatedView.center.y < (self.view.bounds.size.height/4)) {

    float difference = (self.view.bounds.size.height/4) - myAnimatedView.center.y;
    score += (int)difference;
    NSString *nssScore = [NSString stringWithFormat:@"%i", score];
    scorelabel.text = nssScore;
    myAnimatedView.center = CGPointMake(myAnimatedView.center.x, myAnimatedView.center.y - difference);
    scorelabel.center = CGPointMake(scorelabel.center.x, scorelabel.center.y - difference);



    b1.center = CGPointMake(b1.center.x, b1.center.y - (difference/2));
    b2.center = CGPointMake(b2.center.x, b2.center.y - (difference/2));

    if (b1.center.y > self.view.bounds.size.height - (b1.bounds.size.height/2)) {
        b1.center = CGPointMake(b1.center.x, b2.center.y - 460);
    }

    if (b2.center.y > self.view.bounds.size.height - (b2.bounds.size.height/2)) {
        b2.center = CGPointMake(b2.center.x, b1.center.y - 460);
    }

    float viewWidth = self.view.bounds.size.width;
    float fViewWidthMinusPlatformWidth = viewWidth - 55.0f;
    int iViewWidthMinusPlatformWidth = (int)fViewWidthMinusPlatformWidth;

}

这应该是这样,当 uiimageview 在屏幕上通过第 3/4 标记时,新的背景开始显示。但是,它不会改变背景。有人知道这里有什么不工作吗?提前致谢。

4

0 回答 0