-4
我在我的項目中有兩個班級:SIAViewController.h
及其子班級cell.h
。我如何修復警告
在cell.h
我
@interface cell : UIViewController
@property(nonatomic)CGRect frame;
@property(assign,nonatomic)UIImage *image;
@property(nonatomic)int tag;
@property(nonatomic)bool userInteractionEnabled;
@property(retain,nonatomic)UITapGestureRecognizer *addGestureRecognizer;
@end
而且在SIAViewController.m
:
int x=20,y=50,t=1;
cell *tank[9][9];
for(int i=1;i<=8;i++)
{
for(int j=1;j<=8;j++)
{
tank[i][j]=[[cell alloc]init];
tank[i][j].frame=CGRectMake(x, y, 35, 35);
UIImage *myImage=[UIImage imageNamed:@"s.jpg"];
[tank[i][j] setImage:myImage];
tank[i][j].tag=t;
tank[i][j].userInteractionEnabled=YES;
UITapGestureRecognizer * recognizer = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapDetected:)];
tank[i][j]. addGestureRecognizer=recognizer;
[self.view addSubview:tank[i][j]];
x+=35;
t++;
}
y+=35;
x=20;
}
,當運行這個項目我收到線不兼容的指針類型的細胞發送到__strong類型的UIView的參數。誰能幫我。我是xcode的新手。謝謝
看到我收到線程終止應用程序,由於未捕獲的異常'NSInvalidArgumentException',原因:' - [cell superview]:無法識別的選擇器發送到實例0x68441d0' – Shaan 2012-07-09 06:37:13