如果有的话,这些方法中哪一个适合:
- 更改 CATextLayer 的文本
- 将不同的图像加载到 CAImageLayer 中
- 告诉子层自我更新
老兄,我可能喝醉了......但是没有drawRect方法CAlayers
我想你可以使用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:
, 这是肯定的。)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)