I’m trying to create an if statement with the condition depending on a variable object. How can I go about this?
Here is the gist of what I’m trying to do…
if ([gestureRecognizer state] == UIGestureRecognizerStateEnded)
{
if (somecondition)
{
//Do stuff
}
else if (CGRectIntersectsRect(currentImage.frame, **anyOfTheImagesInMyArray**.frame))
{
//Do stuff
}
}
How can I get the else if condition to check more than one UIView frame before testing true or false?
Updated Code:
What do I do in this case?
if ([gestureRecognizer state] == UIGestureRecognizerStateEnded)
{
if (CGRectIntersectsRect(currentImage.frame, **anyOfTheImagesInMyArray_1**.frame))
{
//Do stuff
}
else if (CGRectIntersectsRect(currentImage.frame, **anyOfTheImagesInMyArray_2**.frame))
{
if (condition) {
//do stuff
}
else if (condition){
//do something else
}
}
else if (CGRectIntersectsRect(currentImage.frame, **anyOfTheImagesInMyArray_3**.frame))
{
if (condition) {
//do stuff
}
else if (condition){
//do something else
}
}
else if (CGRectIntersectsRect(currentImage.frame, **anyOfTheImagesInMyArray_4**.frame))
{
if (condition) {
//do stuff
}
else if (condition){
//do something else
}
}
}
Not sure if I got the question right, but if you want to perform some tasks on every image in the array it should look e.g. like this: