ここに私が持っているコードがあります:
for (NSValue * i in cgpointarray){
[text setHidden:NO];
CGPoint temppoint = i.CGPointValue;
if (touchended.x < temppoint.x+36 && touchended.x > temppoint.x-36 && touchended.y < temppoint.y+36 && touchended.y > temppoint.y -36){
spacetouched = i;
break;
}
目的は、各スペース (配列の cgpoint x) +または- 36 ピクセルでタッチされた CGPoint を検索することです。ただし、テキストという名前のラベルを作成して非表示に設定しました。このコードを実行すると、テキスト ラベルが表示されないため、コードが実行されていないと思います。cgpointarray は、違いがある場合は NSMutableArray です。
編集: この行:CGPoint temppoint = i.CGPointValue;
コンパイラは言う: 'i' のローカル宣言はインスタンス変数を非表示にします