總而言之參數2 ....不兼容的類型爲「CGRectContainsPoint」
我得到不兼容的類型爲「CGRectContainsPoint」參數2上的網格的[X] [Y] .frame部分([rubin1 frame],grid [x] [y] .frame),([rubin2 frame],grid [x] [y] .frame)和([rubin3 frame],grid [x] [y ]。幀)。我嘗試了[grid [x] [y] frame],但得到了同樣的錯誤。
我想能到我釋放他們在磚上來回走動魯賓1,對電網rubin2和rubin3。當我釋放他們的磚,然後我想這塊磚消失以及任何其他相同類型的磚是,魯賓的地方在左邊(無論身在何處,他們都在網格)
for (int y = 0; y < BRICKHEIGHT; y++)
{
for (int x = 0; x < BRICKWIDTH; x++)
{
if (CGRectContainsPoint([rubin1 frame], grid[x][y].frame)) {
if(grid[x][y].tag == 1){
ruby--;
rubin1.alpha = 0;
grid[x][y].alpha = 0;
[self PlayerScore: x y: y];
}
else if(grid[x][y].tag == 2){
ruby--;
rubin1.alpha = 0;
grid[x][y].alpha = 0;
[self PlayerScore: x y: y];
}
else if(grid[x][y].tag == 3){
ruby--;
rubin1.alpha = 0;
grid[x][y].alpha = 0;
[self PlayerScore: x y: y];
}
else if(grid[x][y].tag == 4){
ruby--;
rubin1.alpha = 0;
grid[x][y].alpha = 0;
[self PlayerScore: x y: y];
}
else if(grid[x][y].tag == 5){
ruby--;
rubin1.alpha = 0;
grid[x][y].alpha = 0;
[self PlayerScore: x y: y];
}
else if(grid[x][y].tag == 6){
ruby--;
rubin1.alpha = 0;
grid[x][y].alpha = 0;
[self PlayerScore: x y: y];
}
}
if (CGRectContainsPoint([rubin2 frame], grid[x][y].frame)) {
if(grid[x][y].tag == 1){
ruby--;
rubin2.alpha = 0;
grid[x][y].alpha = 0;
[self PlayerScore: x y: y];
}
else if(grid[x][y].tag == 2){
ruby--;
rubin2.alpha = 0;
grid[x][y].alpha = 0;
[self PlayerScore: x y: y];
}
else if(grid[x][y].tag == 3){
ruby--;
rubin2.alpha = 0;
grid[x][y].alpha = 0;
[self PlayerScore: x y: y];
}
else if(grid[x][y].tag == 4){
ruby--;
rubin2.alpha = 0;
grid[x][y].alpha = 0;
[self PlayerScore: x y: y];
}
else if(grid[x][y].tag == 5){
ruby--;
rubin2.alpha = 0;
grid[x][y].alpha = 0;
[self PlayerScore: x y: y];
}
else if(grid[x][y].tag == 6){
ruby--;
rubin2.alpha = 0;
grid[x][y].alpha = 0;
[self PlayerScore: x y: y];
}
}
if (CGRectContainsPoint([rubin3 frame], grid[x][y].frame)) {
if(grid[x][y].tag == 1){
ruby--;
rubin3.alpha = 0;
grid[x][y].alpha = 0;
[self PlayerScore: x y: y];
}
else if(grid[x][y].tag == 2){
ruby--;
rubin3.alpha = 0;
grid[x][y].alpha = 0;
[self PlayerScore: x y: y];
}
else if(grid[x][y].tag == 3){
ruby--;
rubin3.alpha = 0;
grid[x][y].alpha = 0;
[self PlayerScore: x y: y];
}
else if(grid[x][y].tag == 4){
ruby--;
rubin3.alpha = 0;
grid[x][y].alpha = 0;
[self PlayerScore: x y: y];
}
else if(grid[x][y].tag == 5){
ruby--;
rubin3.alpha = 0;
grid[x][y].alpha = 0;
[self PlayerScore: x y: y];
}
else if(grid[x][y].tag == 6){
ruby--;
rubin3.alpha = 0;
grid[x][y].alpha = 0;
}
}
}
}
感謝您的意見:) – iphonedevonthemake 2011-05-23 06:28:02
再次嘿!我意識到我做錯了方式..這就是爲什麼它不工作...我用CGRectContainsPoint而不是使用CGRectIntersectsRect。它現在工作正常。感謝所有幫助 – iphonedevonthemake 2011-05-25 04:01:02