ios滚动背景

时间:2012-08-17 21:32:09

标签: objective-c ios uiimageview

我想在xcode中创建一个infintite滚动背景但是当我使用这段代码时:

    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标记时,这应该是这样的,新的背景开始显示。但是,它并没有改变背景。谁知道什么不在这里工作?提前谢谢。

0 个答案:

没有答案