我的项目中有两个类: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 的新手。谢谢