Hey guys, I'm working on a little game for the iPhone.
I have a bunch of UIImageViews stored in a 2d array.
for some reason, upperBound and lowerBound display the exact same value in the console for every iteration through the loop. I'm stuck, got any ideas? The variable columnIndex is constant and irrelevant.
My only guess is that currentOne (the UIImageView I access in the 2d array in each loop) is just sticking with the first value it was assigned and not changing. What is the reason for this?
I have a bunch of UIImageViews stored in a 2d array.
Code:
int row = [allLinesOfBlocks count]-1;
int count = 0;
int upperBound;
int lowerBound;
BOOL found = NO;
UIImageView *currentOne;
while((row >= 0 && count < 15) && found == NO)
{
NSLog(@"Row in: %d", row);
currentOne = [[allLinesOfBlocks objectAtIndex:row] objectAtIndex:columnIndex];
upperBound = currentOne.center.y + 16;
lowerBound = currentOne.center.y - 16;
NSLog(@"upper bound: %d", upperBound);
NSLog(@"lower bound: %d", lowerBound);
NSLog(@"actualValue: %d", yLocation);
if(yLocation <= upperBound && yLocation >= lowerBound)
{
found = YES;
rowIndex = row;
NSLog(@"WE FOUND HIM");
}
count++;
row--;
}
for some reason, upperBound and lowerBound display the exact same value in the console for every iteration through the loop. I'm stuck, got any ideas? The variable columnIndex is constant and irrelevant.
My only guess is that currentOne (the UIImageView I access in the 2d array in each loop) is just sticking with the first value it was assigned and not changing. What is the reason for this?