I have two layers. The bottom layer consists of hidden UIImageView
s, the upper layer consists of visible UIImageView
s. When all the frames of the bottom layer UIImageView
s are equal to the frames of the upper layer UIImageView
s, you have to see that in a NSLog
.
The problem is that the boolean method which is called by a NSTimer
always returns true immediately, so I see the NSLog
. I only want to see the NSLog
when all corresponding frames are equal to each other.
This is my code:
- (void)checkTheFrames {
BOOL allEquals = [self isEqualFrames];
if (allEquals) {
NSLog(@"ALL THE FRAMES ARE EQUAL");
[AllPosCorrectTimer invalidate];
}
}
-(BOOL)isEqualFrames {
for(int i = 0; i < arrayImg.count; i++ ){
UIImageView *ImageView1 = arrayImg[i];
UIImageView *ImageView2 = HiddenFieldView[i];
if (!CGRectEqualToRect(ImageView1.frame, ImageView2.frame)) {
return NO;
}
}
return YES;
}
Is there a way to solve this issue?