UIImageVIewでUIButtonを表示することができました。これが更新コードです。最近の問題を一番下に述べました。
imageView = [[UIImageView alloc] initWithImage:image]; //initWithImage:image
//imageView.tag = i;//tag our images for later use when we place them in serial form
[imageView setContentMode:UIViewContentModeScaleToFill]; //though it has no impact
imageView.userInteractionEnabled = YES; //to enable touch interaction with image
[self addSubview:imageView];
UIButton *btn = [[UIButton buttonWithType:UIButtonTypeContactAdd] retain]; //Plus icon button
btn.frame = CGRectMake(215, 550, 100, 100);
[btn addTarget:self action:@selector(onClickHotSpotButton) forControlEvents:UIControlEventTouchUpInside]; //it wasnt working
**[self addSubview:btn]; //Buttons are clickable but shows button on all images**
//[imageView addSubview:btn]; //Buttons are not clickable and are shown on all images
私は今、二つの選択肢があります。私は自分のボタンをImageViewのサブビューにするのか、ImageViewの親であるScrollViewにするのか。もし私が[self addSubView:btn]のようにScrollviewのボタンのサブビューを作るなら、それは右の位置に表示され、クリック可能ですが、親ビューのサブビュー、つまりスクロールビューになっているため、キューのすべてのイメージに作成されるという問題があります。それ以外の場合、すべての画像で一意ですが、すべての画像に表示され、クリックできないImageViewという子ビューのサブビューにすると、
私はそれをクリック可能にし、動的ボタンと画像との間のリンクを維持する方法について、any1が私を導くことができるので、キュー内の各画像上の様々な位置に異なるボタンを持つことができます。