I have a counter that make counter++ every time one image touches another image.
Now what I want to do is: if counter=2; do something, but I always get an error:
Assignment makes pointer from integer without a cast
Here is a part of the code:
-(void)checkcollision {
if(CGRectIntersectsRect(flakeImage.frame, viewToRotate.frame)) {
counter++;
}
}
-(void)checknumber {
if(counter=2) {
viewToRotate.alpha=0;
}
}
Are you perhaps doing this:
This is a common error in
ifstatements. The correction would be:This is just a guess though – I would need to see some more information about the error, or about what you want to do.
EDIT
Ah – have seen your newly posted code, confirming what I stated above. Your code reads that you are trying to assign the value ‘2’ to
counterin theifstatement. You want the==to make this a check for equality.