2
這些方法中的哪一個,如果有一個,會是一個合適的位置:CALayer的display/drawRect方法究竟會發生什麼?
- 更改一個CATextLayer
- 負荷的文本不同的圖像變成CAImageLayer
- 告訴子層來更新自己
這些方法中的哪一個,如果有一個,會是一個合適的位置:CALayer的display/drawRect方法究竟會發生什麼?
哥們我可以解釋爲醉......但在CAlayers
NO的drawRect方法,我認爲你可以使用drawInContext:
實際上(吞下)吸引CALayers,但沒有人足以做到二戰以來。
關於顯示,您不需要調用它,它基本上更新您使用.contents
設置的內容。
我只是用.contents
這樣的事情...
[self.view setLayer:rearLayer];
[self.view setWantsLayer:YES];
rearLayer.frame = CGRectMake(gameBlah,gameBlah, 1024,768);
// note that we are dealing there with the mysteries of rearLayer positioning;
// it is measured by the SUPER layer of the layer in question!
// (indeed much as frame for the view is, if you think about it ..)
rearLayer.contents = (id)loadMacStylePng(@"spaceShip");
說的是有膽量來寫自己drawInContext:
...
在這種情況下,它被調用(或抽象出來。 ..或重新計算,或什麼)當您撥打displayAsNeeded
。 (我從來不需要撥打displayAsNeeded:
,這是肯定的。)