开发者

CATiledLayer is being rendered underneath a UIView

I'm making a PDF reader that looks like a real book.

I have a UIImageView inside a scrollview as the book's background (imagine an open book with empty pages). The UIImageView's layer has 2 sublayers each positioned over each page, CATiledLayers that render PDF content.

开发者_运维问答

I have 2 UIViews whose layer uses an image as its contents. When I hit a button to turn the page, I take the CATiledLayer attached to the background and remove him but then add him to the UIView's layer as a sublayer. This UIView's layer animates a page turning, and with it animates that PDF page. I create a new PDF page and put it where the old one used to be.

So now there is a PDF page as a sublayer on the background UIImageView, and a UIView overtop of that with a PDF page as a sublayer. For some reason the PDF on the page underneath is visible during the animation. It should not be visible because the turning page should be obstructing it. Question is, why is that happening?


I just had to change the zPosition property of the UIView's layers to a really high number like 10000. I had it set to 0.1 initially but that wasn't enough. Then the compositing worked again.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜