开发者

How to resolve warning "No '-modelLayer' method found" for CALayer class in iPhone unit test

I'm getting the warning that no '-modelLayer' method is found for the class CALayer in the following code. According to the CALayer class reference the modelLayer method does exist. This c开发者_JAVA百科ode executes correctly, so this confirms that the implementation is there at runtime. I presume I just need to add some casting to get rid of the warning, but I'm not sure what to cast to.

How can I resolve the warning?

I'm using Xcode 4.0 Build 4A278b.

Code:

CALayer * layer = (CALayer *)(coinView.layer);
CGRect newCoinFrame = [[layer modelLayer] frame];  //warning on this line

Warning: CoinsToSlotViewControllerTest.m:138: warning: no '-modelLayer' method found

CALayer ref: http://developer.apple.com/library/mac/#documentation/GraphicsImaging/Reference/CALayer_class/Introduction/Introduction.html


I think you need to #import <QuartzCore/QuartzCore.h>.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜