CALayerInvalidGeometry', reason: 'CALayer bounds contains NaN: [0 0; nan nan] crash in view CALayerInvalidGeometry', reason: 'CALayer bounds contains NaN: [0 0; nan nan] crash in view xcode xcode

CALayerInvalidGeometry', reason: 'CALayer bounds contains NaN: [0 0; nan nan] crash in view


According to the stack trace the problem is here

imageView_A.frame = CGRectMake(300, 200, 3.86, 3.86);

Try to set the imageView_A.transform to identity. Another solution (and I think better) would be using the UIScrollView for scaling (it is also could be made animated).

Edit: try this

    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.frame = CGRectMake(300, 200, 386.0f, 386.0f);    [UIView commitAnimations];