开发者

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

开发者 https://www.devze.com 2023-02-14 03:15 出处:网络
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

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

精彩评论

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