画像 (この場合は「goodCell.png」) を描画するたびに、ビュー コントローラーのウィンドウの特定の xy 座標で、適切なパラメーターを含む次のメソッドを呼び出します。
-(void)paintGoodCellatX:(int)xAxis andY:(int)yAxis onViewController:(UIViewController*)playingViewController
{
int x = 32*(xAxis - 1);
int y = 384 - (32* yAxis);
UIImage* myImage = [UIImage imageNamed:@"goodCell.png"];
UIImageView* myImageView = [[UIImageView alloc] initWithImage:myImage];
myImageView.frame = CGRectMake(x,y, 32, 32);
[playingViewController.view addSubview:myImageView];
}
コード中のある時点で、特定の x & y 座標で描画された上記の画像の 1 つを削除したい場合、どうすればよいですか?
このコードを考えると、座標を除いて、描画した ImageView を保持するものは何もありません (したがって[myImageView removeFromSuperView];
、名前が何も定義していないため、次のようなものは使用できません)。myImageView
View Controllerウィンドウの特定のxy座標でUIImageViewを削除/削除する方法、またはこの問題を回避する他の方法はありますか?
ありがとうございました