I looked at this a lot, but I can only imagine the webView and tables related to this problem. Mine is completely different, it seems, with the same exception:
CALayerInvalidGeometry ', reason:' CALayer bounds contains NaN: [0 0; nan nan]
Basically what I have is a view that reduces and scales images. I recently decided to change my code using CGAffineTransformScale in a UIView animation, instead of scaling everything to the mark every time the timer ticks. This uses less processing power.
But no matter what order I have photos in, it always crashes after the 19th. This does not seem to be a problem with the array of positioning coordinates to which it refers, since it has a length of only 6 and loops after it reaches its length. So for some reason, since I implemented this animation code, it gives me this error. Does anyone know why?
Here is the part that I have changed since its disruption:
-(void) onTimer{ if(scaleTimer_A==5){ imageView_A.image = [UIImage imageNamed:[attractList_A objectAtIndex:imageIndex_A]]; imageView_A.frame = CGRectMake(300, 200, 3.86, 3.86); imageView_A.center = CGPointMake(attractLocs_x_A[attractLocs_A_index], attractLocs_y_A[attractLocs_A_index]); [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:2]; imageView_A.alpha = 1; imageView_A.transform = CGAffineTransformScale(imageView_A.transform, 100, 100); [UIView commitAnimations]; } if(scaleTimer_A==10){ [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:.75]; imageView_A.alpha = 0; imageView_A.transform = CGAffineTransformScale(imageView_A.transform, 1.2, 1.2); [UIView commitAnimations]; scaleTimer_A=0; imageIndex_A+=1; if(imageIndex_A==imageIndex_A_size){ imageIndex_A=0; } attractLocs_A_index+=1; if(attractLocs_A_index==attractLocs_A_SIZE){ NSLog(@"Back to zero A"); attractLocs_A_index=0; } NSLog(@"Image A =%@", [attractList_A objectAtIndex:imageIndex_A]); } scaleTimer_A+=1;}
EDIT
This is how I got the code above to work without a problem using CGAffineTransformIdentity.
-(void) onTimer{ if(scaleTimer_A==5){ imageView_A.image = [UIImage imageNamed:[attractList_A objectAtIndex:imageIndex_A]]; imageView_A.transform = CGAffineTransformIdentity; imageView_A.center = CGPointMake(attractLocs_x_A[attractLocs_A_index], attractLocs_y_A[attractLocs_A_index]); [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:2]; imageView_A.alpha = 1; imageView_A.transform = CGAffineTransformScale(CGAffineTransformIdentity, 100, 100); [UIView commitAnimations]; } if(scaleTimer_A==10){ [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:.75]; imageView_A.alpha = 0; imageView_A.transform = CGAffineTransformScale(CGAffineTransformIdentity, 120, 120); [UIView commitAnimations]; scaleTimer_A=0; imageIndex_A+=1; if(imageIndex_A==imageIndex_A_size){ imageIndex_A=0; } attractLocs_A_index+=1; if(attractLocs_A_index==attractLocs_A_SIZE){ NSLog(@"Back to zero A"); attractLocs_A_index=0; } NSLog(@"Image A =%@", [attractList_A objectAtIndex:imageIndex_A]); } scaleTimer_A+=1;}
iphone xcode animation ipad crash
VagueExplanation Feb 01 2018-11-11T00: 00Z
source share