请求成员不是结构或联合

时间:2011-07-25 08:53:34

标签: iphone ios4 iphone-sdk-3.0 cocos2d-iphone ios-simulator

UIImage *img=[[UIImage alloc]initWithFrame:CGRectMake(50,50,145,20)];
img.image=[UIImage imageNamed:@"dollor.png"];

我收到错误“请求成员图像的内容不是结构或联合”,上述代码可以提供帮助。

此外,我对代码

也有同样的错误
img.tag=1;

感谢任何帮助

1 个答案:

答案 0 :(得分:1)

UIImage *img=[[UIImage alloc]initWithFrame:CGRectMake(50,50,145,20)];

应该是

UIImageView *img=[[UIImageView alloc]initWithFrame:CGRectMake(50,50,145,20)];

替换它,一切都会好的......