0

我正在使用 ColorBGView 并在其中调用方法来制作渐变。但是如果我将两个附加到我的图层,它会与我之后附加的所有其他内容重叠,我不明白为什么。

        CAGradientLayer *bgLayer = [ColorBGView pinkSky1];
        bgLayer.frame = CGRectMake(0, 0, 1024, 768);
        [viewController.view.layer insertSublayer:bgLayer atIndex:0];

    //If I insert this sublayer (even at a lower index) 
    //it overlaps everything I attach afterward

        CAGradientLayer *bgLayer2 = [ColorBGView darkCave];
        bgLayer2.frame = CGRectMake(0, 0, 1024, 768);
        [viewController.view.layer insertSublayer:bgLayer2 atIndex:-10];    

        // add custom view

        parallaxView = [[ParallaxView alloc] init];
        parallaxView.frame = CGRectMake(0, 0, 1024, 768);
        [viewController.view insertSubview:parallaxView atIndex:1];

        [parallaxView release];
4

0 回答 0