iphone - 如何解决 iPhone 单元测试中 CALayer 类的警告 "No ' -modelLayer' 找到方法

标签 iphone objective-c cocoa-touch

我收到警告,在以下代码中找不到类 CALayer 的“-modelLayer”方法。根据 CALayer 类引用,modelLayer 方法确实存在。此代码正确执行,因此这证实了在运行时实现。我想我只需要添加一些转换即可消除警告,但我不确定要转换成什么。

如何解决警告?

我使用的是 Xcode 4.0 Build 4A278b。

代码:

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

警告: CoinsToSlotViewControllerTest.m:138:警告:未找到“-modelLayer”方法

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

最佳答案

我认为你需要 #import <QuartzCore/QuartzCore.h> .

关于iphone - 如何解决 iPhone 单元测试中 CALayer 类的警告 "No ' -modelLayer' 找到方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5127851/

相关文章:

ios - 支持的平台、基础 SDK、仅构建事件架构设置在 pod 更新后恢复

c# - JSONModel DATE 转换器为零

iphone - 使用 App Delegate 访问通过 Storyboard 创建的 View Controller

iphone - 重新创建仅显示一行的 UIPickerView

iphone - 如何使用 iPhone 与 IDBlue RFID 笔通信 RFID 标签?

objective-c - 查找路径的父目录

iphone - 多线程 ViewController 中的 UIWebView

ios - 从日历组件创建 NSDate 时出现 1 错误

iphone - TextField 覆盖 UIAlertView 的按钮

iphone - OpenGL纹理图集出血