我正在开发一个应用程序,我需要创建多个图像视图并在所有图像视图上添加事件,我正在做这样的事情但是应用程序正在被终止。请帮助
xFrame=85.0f;
int imgViewIndex=101;
m_PcellTextLabel.text=@"Case Studies";
for (int i=0; i<=noOFBooks; i++)
{
caseStudyImgView=[[UIImageView alloc] initWithFrame:CGRectMake(xFrame, 22, 109, 133)];
caseStudyImgView.tag=imgViewIndex;
[cell.contentView addSubview:caseStudyImgView];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)];
NSArray*gestureArray=[[NSArray alloc] initWithObjects:[NSString stringWithFormat:@"tap%d",i],nil];
NSArray*imgViewArray=[[NSArray alloc] initWithObjects:[NSString stringWithFormat:@"caseStudyImgView%d",i],nil];
printf("Val of gesture array is %s\n",[[gestureArray objectAtIndex:0] UTF8String]);
UITapGestureRecognizer* tapGes =(UITapGestureRecognizer*)[gestureArray objectAtIndex:i];
UIImageView*tempImgView=(UIImageView*)[imgViewArray objectAtIndex:i];
[tempImgView addGestureRecognizer:tapGes];
}