2011-11-17 53 views
0

我有一个单独的类Deck访问数据

enter image description here

enter image description here

Deck包含一组Cards

enter image description here

每个Card除其他事项外还知道分配给它的图像。

enter image description here

当负责显示卡的图像类试图访问它..以及它在这里停止。

enter image description here

为什么我不能访问faceImage?

回答

1

如果键入了[c faceImage];而建,你得到(如果使用ARC)之类的错误“例如消息接收器类型‘卡’是一个向前声明”,或者(如果不使用ARC)类似的警告“找不到实例方法'-faceImage'(返回类型默认为'id')“?

您是否在Deck.h中声明了@class Card

您可能只需要在您尝试访问faceImage的文件中登录#import "Card.h"

+0

确实你是对的。忘了'#import Card.h'。谢谢 – JAM