gpt4 book ai didi

iphone - CATiledLayer 高于正常 CALayer

转载 作者:行者123 更新时间:2023-11-29 05:06:17 29 4
gpt4 key购买 nike

我正在尝试在一个图层上添加两个子图层。一个图层应充当(快速渲染)背景,而另一图层(CATiledLayer)应显示其他内容。但是,CATiledLayer 不会出现在前面。普通的CALayer总是隐藏CATiledLayer。当我删除该行

[self.layer addSublayer:lowRes];

CATiledLayer 可见。但背景并没有偏离。

这是相关代码部分

tiledLayer = [CATiledLayer layer];
//tiledLayer.delegate = self;
tiledLayer.tileSize = CGSizeMake(800.0, 800.0);
tiledLayer.levelsOfDetail = 4;
tiledLayer.levelsOfDetailBias = 4;
tiledLayer.frame = pageRect;
tiledLayer.zPosition = 2;
[tiledLayer setNeedsLayout];
[tiledLayer retain];

CALayer * lowRes = [CALayer layer];
lowRes.frame = tiledLayer.frame;
lowRes.zPosition = 1;
lowRes.contents = (id) [UIImage imageNamed:@"krant.jpg"].CGImage;
[self.layer addSublayer:tiledLayer];
[self.layer addSublayer:lowRes];

如何使 CATiledLayer 在 CALayer 上方可见?提前致谢。

最佳答案

已尝试反转 addSubLayer 调用?

[self.layer addSublayer:lowRes];

[self.layer addSublayer:tiledLayer];

关于iphone - CATiledLayer 高于正常 CALayer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5050561/

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