CATiledLayer 高于正常 CALayer
我正在尝试在一个图层上添加两个子图层。一个图层应充当(快速渲染)背景,而另一图层(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 上方可见?提前致谢。
I am trying to add two sublayers on a layer. One layer should act as a (fast rendering) background while the other (the CATiledLayer) should display other content. However, the CATiledLayer won't appear at front. The normal CALayer always hides the CATiledLayer. When I remove the line
[self.layer addSublayer:lowRes];
the CATiledLayer is visible. But the background is not off course.
Here is the relevant code part
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];
How can i make the CATiledLayer visible above the CALayer? Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
已经尝试反转 addSubLayer 调用?
already tried to invert the addSubLayer calls?